List of usage examples for android.view ViewGroup findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:com.conferenceengineer.android.iosched.ui.WhatsOnFragment.java
/** * Show the the announcements// ww w . ja v a 2s. c o m */ private void showAnnouncements() { mAnnouncementsCursor.moveToFirst(); ViewGroup announcementsRootView = (ViewGroup) mInflater.inflate(R.layout.whats_on_announcements, mRootView, false); mAnnouncementView = announcementsRootView.findViewById(R.id.announcement_container); // Begin cycling in announcements mHandler.post(mCycleAnnouncementsRunnable); final View moreButton = announcementsRootView.findViewById(R.id.extra_button); moreButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(getActivity(), AnnouncementsActivity.class)); } }); mRootView.removeAllViews(); mRootView.addView(announcementsRootView); }
From source file:com.abcvoipsip.ui.messages.ConversationsListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) { View v = inflater.inflate(R.layout.call_log_fragment, container, false); ListView lv = (ListView) v.findViewById(android.R.id.list); // Add header ViewGroup headerView = (ViewGroup) inflater.inflate(R.layout.conversation_list_item, lv, false); ((TextView) headerView.findViewById(R.id.from)).setText(R.string.new_message); ((TextView) headerView.findViewById(R.id.subject)).setText(R.string.create_new_message); headerView.findViewById(R.id.quick_contact_photo).setVisibility(View.GONE); lv.addHeaderView(headerView, null, true); TextView tv = (TextView) v.findViewById(android.R.id.empty); tv.setText(R.string.status_none);/*www . j ava 2 s .c om*/ return v; }
From source file:com.andrew.apollo.ui.fragments.PlaylistFragment.java
/** * {@inheritDoc}/*from w w w .j ava 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 = (ListView) rootView.findViewById(R.id.list_base); // Set the data behind the grid 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); return rootView; }
From source file:com.andrew.apollo.ui.fragments.profile.ArtistAlbumFragment.java
/** * {@inheritDoc}/*from w w w . j a v a2 s. com*/ */ @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 = (ListView) rootView.findViewById(R.id.list_base); // Set the data behind the grid mListView.setAdapter(mAdapter); // Release any references to the recycled Views mListView.setRecyclerListener(new RecycleHolder()); // Listen for ContextMenus to be created mListView.setOnCreateContextMenuListener(this); // Show the songs from the selected album mListView.setOnItemClickListener(this); // To help make scrolling smooth mListView.setOnScrollListener(new VerticalScrollListener(mScrollableHeader, mProfileTabCarousel, 1)); // 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:de.gebatzens.ggvertretungsplan.fragment.NewsFragment.java
@Override public void createView(LayoutInflater inflater, ViewGroup view) { lv = new ListView(getActivity()); int p = toPixels(10); //lv.getDivider().setColorFilter(GGApp.GG_APP.provider.getColor(), PorterDuff.Mode.ADD); lv.setDrawSelectorOnTop(true);//from ww w .ja v a 2 s . c o m lv.setDivider(getResources().getDrawable(R.drawable.listview_divider)); ((LinearLayout) view.findViewById(R.id.news_content)).addView(lv); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { TextView txtTitle = (TextView) view.findViewById(R.id.newsTitle); TextView txtContent = (TextView) view.findViewById(R.id.newsContent); String mTitle = txtTitle.getText().toString(); String mContent = txtContent.getText().toString(); AlertDialog.Builder ad = new AlertDialog.Builder(view.getContext()); ad.setTitle(mTitle); ad.setMessage(mContent); ad.setNegativeButton(GGApp.GG_APP.getResources().getString(R.string.close), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); ad.show(); if (!mDatabaseHelper.checkNewsRead(mTitle)) { mDatabaseHelper.addReadNews(mTitle); nfla.notifyDataSetChanged(); } } }); nfla = new NewsFragmentListAdapter(getActivity(), GGApp.GG_APP.news); lv.setAdapter(nfla); }
From source file:au.org.ala.fielddata.mobile.SurveyBuilder.java
private Spinner buildCategorizedSpinner(Attribute attribute, ViewGroup parent) { ViewGroup row = (ViewGroup) viewContext.getLayoutInflater().inflate(R.layout.categorized_spinner_view, parent);/*from w ww . j av a2s .c o m*/ CategorizedSpinner spinner = (CategorizedSpinner) row.findViewById(R.id.spinner); spinner.setPrompt("Select " + attribute.description); spinner.setItems(attribute.options); return spinner; }
From source file:org.jorge.lbudget.ui.util.undobar.UndoBar.java
/** * Checks if there is already an {@link UndoBarView} instance added to the * given {@link Activity}.<br>/*from w w w . j a va 2 s . co m*/ * If {@code true}, returns that instance.<br> * If {@code false}, inflates a new {@link UndoBarView} and returns it. */ private UndoBarView getView(Activity activity) { ViewGroup rootView = (ViewGroup) activity.findViewById(android.R.id.content); UndoBarView undoBarView = (UndoBarView) rootView.findViewById(R.id.undoBar); if (undoBarView == null) { undoBarView = (UndoBarView) LayoutInflater.from(activity).inflate(R.layout.other_ui_undo_bar, rootView, false); rootView.addView(undoBarView); } return undoBarView; }
From source file:fr.shywim.antoinedaniel.ui.fragment.VideoListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_video_list, container, false); listView = (RecyclerView) root.findViewById(R.id.videos_list); listView.setAdapter(setupAdapter()); listView.setLayoutManager(/* w ww .j a va 2 s. c o m*/ new StaggeredGridLayoutManager(getColumnNumber(), StaggeredGridLayoutManager.VERTICAL)); ((CursorRecyclerAdapter) listView.getAdapter()) .setOnClickListener(new CursorRecyclerAdapter.OnClickListener() { @Override public void onClick(View v, String videoId, String videoName) { displayDetailsFragment(v, videoId, videoName); } }); mToolbar = (Toolbar) root.findViewById(R.id.toolbar_actionbar); mToolbar.setTitle(""); ((FragmentsCallbacks) mContext).setActionBarToolbar(mToolbar); ((View) mToolbar.getParent()).getBackground().setAlpha(255); mStatusBarBg = root.findViewById(R.id.statusbar_bg); UiUtils.setStatusBarBackground(mStatusBarBg, getResources()); setupToolbarSpinner((Spinner) root.findViewById(R.id.videos_list_chooser)); return root; }
From source file:com.woodblockwithoutco.quickcontroldock.ui.factory.ServiceViewFactory.java
private void initTestVersionText(ViewGroup container) { TextView tv = (TextView) container.findViewById(R.id.test_version_text); initTextView(tv); }
From source file:com.example.h.medapp.QuestionActivity.java
private void addItem() { answered_flag = false;/*from w ww .j a v a 2 s . com*/ textView.setText("Question " + (count + 1) + " / 10"); // Instantiate a new "row" view. final ViewGroup newView = (ViewGroup) LayoutInflater.from(this).inflate(R.layout.row, mContainerView, false); mContainerView.addView(newView); SeekBar seekBar = (SeekBar) newView.findViewById(R.id.progress_bar); TextView question_text_view = (TextView) newView.findViewById(R.id.question_text); Button next_button = (Button) newView.findViewById(R.id.next_button); final TextView slider_textView = (TextView) newView.findViewById(R.id.slider_text); scrollView.scrollBy(0, +1000); slider_textView.setVisibility(View.INVISIBLE); question_text_view.setText(questions_array[count]); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { int progress = 0; @Override public void onProgressChanged(SeekBar seekBar, int progresValue, boolean fromUser) { progress = progresValue; } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { answered_flag = true; Toast.makeText(getApplicationContext(), "Stopped tracking seekbar", Toast.LENGTH_SHORT).show(); //TODO: save the result to an array result_array[count] = progress; slider_textView.setVisibility(View.VISIBLE); slider_textView.setText("you have chosen: " + seekBar.getProgress() + "/" + seekBar.getMax() + " as your degree of symptom."); } }); next_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { if (answered_flag) { //MAKE SURE THIS QUESTION IS NOT THE LAST QUESTION. //IF IT IS THE LAST QUESTION GO TO THANK YOU ACTIVITY if (count == total_number_of_question - 1) { //TODO: save to parse //TODO: go to thank you activity Intent intent = new Intent(QuestionActivity.this, activity_T.class); startActivity(intent); } else { //IF NOT GO TO NEXT QUESTION count++; addItem(); } } } }); }