List of usage examples for android.view View findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:com.madgag.agit.RDTypeListActivityStoryTest.java
public void testShouldShowAllTags() throws Exception { Repository repoWithTags = unpackRepo("small-repo.with-tags.zip"); setActivityIntent(listIntent(repoWithTags, "tag")); final RDTypeListActivity activity = getActivity(); ListView listView = activity.getListView(); checkCanSelectEveryItemInNonEmpty(listView); RDTTag tagDomainType = new RDTTag(repoWithTags); List<TagSummary> summaries = tagDomainType.getAll(); Log.i(TAG, "Should be " + summaries.size() + " elements in the list.. there are " + listView.getCount()); assertThat(listView.getCount(), is(summaries.size())); for (int index = 0; index < summaries.size(); ++index) { TagSummary summary = summaries.get(index); View itemView = getItemViewBySelecting(listView, index); Log.d(TAG, "summary=" + summary + " view=" + itemView); TextView itemTitleTextView = (TextView) itemView.findViewById(android.R.id.text1); assertThat(itemTitleTextView.getText(), is(summary.getName())); if (summary.getName().equals("annotated-tag-of-2nd-commit")) { CharSequence dt = ((TextView) itemView.findViewById(android.R.id.text2)).getText(); Log.i(TAG, "Looking... " + dt); assertThat(dt, charSequence(startsWith("Commit"))); assertThat(dt, charSequence(containsString("Adding my happy folder with it's tags"))); }/* ww w . j a va 2 s .c o m*/ } }
From source file:com.networksaremadeofstring.anonionooid.RelayGraphDetailsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_details_swipe_graphs, container, false); graphContainer = (LinearLayout) rootView.findViewById(R.id.graphContainer); return rootView; }
From source file:li.barter.fragments.ReportBugFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { init(container, savedInstanceState); setActionBarTitle(R.string.Report_fragment_title); final View view = inflater.inflate(R.layout.fragment_report_bug, null); mReportedBugTextView = (EditText) view.findViewById(R.id.text_bug_description); mDeviceInfoTextView = (EditText) view.findViewById(R.id.text_device_description); mReportBugSelect = (RadioButton) view.findViewById(R.id.radio_reportbug); mReportSuggestionSelect = (RadioButton) view.findViewById(R.id.radio_suggestfeature); mReportSuggestionSelect.setOnCheckedChangeListener(this); mReportSuggestionSelect.setChecked(true); mReportBugButton = (Button) view.findViewById(R.id.button_report_bug); mReportBugButton.setOnClickListener(this); return view;/*from w ww .jav a2 s . com*/ }
From source file:com.skubit.android.transactions.TransactionsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.wallet_transactions_fragment, null); TextView balanceLabel = (TextView) view.findViewById(R.id.wallet_balance_label); balanceLabel.setTypeface(FontManager.CONDENSED_REGULAR); mBalance = (TextView) view.findViewById(R.id.wallet_balance); ListView list = (ListView) view.findViewById(R.id.list); list.setAdapter(mAdapter);/* w ww . jav a2 s . co m*/ list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapter, View arg1, int position, long arg3) { TransactionDto transactionDto = (TransactionDto) adapter.getItemAtPosition(position); ObjectMapper mapper = new ObjectMapper(); String value; try { value = mapper.writeValueAsString(transactionDto); startActivity(TransactionDetailsActivity.newIntent(value, getActivity().getPackageName())); } catch (JsonProcessingException e) { e.printStackTrace(); } } }); return view; }
From source file:com.ateam.alleneatonautorentals.SalesViewUsers.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.view_users); usersList = new ArrayList<HashMap<String, String>>(); new LoadAllUsers().execute(); SessionManager session = new SessionManager(getApplicationContext()); String role = session.getRole(); if (role.equals("Sales") || role.equals("Manager")) { ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { @Override/*from www .j a v a 2s. co m*/ public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String email = (((TextView) view.findViewById(R.id.user_email_list)).getText().toString()) .substring(7); String name = ((TextView) view.findViewById(R.id.user_name_list)).getText().toString(); Intent ii = new Intent(getApplicationContext(), SalesUserMenu.class); ii.putExtra(TAG_EMAIL, email); ii.putExtra("key", ""); ii.putExtra(TAG_NAME, name); startActivity(ii); finish(); } }); } }
From source file:at.bitfire.davdroid.syncadapter.LoginURLFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.login_url, container, false); // protocol selection spinner textHttpWarning = (TextView) v.findViewById(R.id.http_warning); spnrScheme = (Spinner) v.findViewById(R.id.login_scheme); spnrScheme.setOnItemSelectedListener(new OnItemSelectedListener() { @Override/*from w w w .j a va 2s .c o m*/ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String scheme = parent.getAdapter().getItem(position).toString(); textHttpWarning.setVisibility(scheme.equals("https://") ? View.GONE : View.VISIBLE); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); spnrScheme.setSelection(1); // HTTPS // other input fields editBaseURI = (EditText) v.findViewById(R.id.login_host_path); editBaseURI.addTextChangedListener(this); editUserName = (EditText) v.findViewById(R.id.userName); editUserName.addTextChangedListener(this); editPassword = (EditText) v.findViewById(R.id.password); editPassword.addTextChangedListener(this); checkboxPreemptive = (CheckBox) v.findViewById(R.id.auth_preemptive); // hook into action bar setHasOptionsMenu(true); return v; }
From source file:net.naonedbus.card.impl.TraficCard.java
private View createView(final LayoutInflater inflater, final ViewGroup root, final InfoTrafic infoTrafic) { final View view = inflater.inflate(R.layout.card_item_trafic_ligne, root, false); final TextView itemTitle = (TextView) view.findViewById(R.id.itemTitle); final TextView itemDate = (TextView) view.findViewById(R.id.itemDate); itemTitle.setText(infoTrafic.getIntitule()); itemDate.setText(infoTrafic.getDateFormated()); if (isCurrent(infoTrafic)) { itemDate.setCompoundDrawablesWithIntrinsicBounds(R.drawable.info_trafic_on, 0, 0, 0); } else {/*from w w w . j a va2 s.c om*/ itemDate.setCompoundDrawablesWithIntrinsicBounds(R.drawable.info_trafic_off, 0, 0, 0); } view.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { final Bundle bundle = new Bundle(); bundle.putParcelable(InfoTraficDetailFragment.PARAM_INFO_TRAFIC, infoTrafic); final DialogFragment dialogFragment = new InfoTraficDetailDialogFragment(); dialogFragment.setArguments(bundle); dialogFragment.show(getFragmentManager(), "InfoTraficDetailDialogFragment"); } }); return view; }
From source file:com.example.android.donebar.DoneBarActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // BEGIN_INCLUDE (inflate_set_custom_view) // Inflate a "Done/Cancel" custom action bar view. final LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext() .getSystemService(LAYOUT_INFLATER_SERVICE); final View customActionBarView = inflater.inflate(R.layout.actionbar_custom_view_done_cancel, null); customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(new View.OnClickListener() { @Override//w w w. j a va 2 s. c om public void onClick(View v) { // "Done" int id = generateId(); EditText number = (EditText) findViewById(R.id.caller_phone_number); EditText information = (EditText) findViewById(R.id.caller_information); checkAvailability(id, number.getText().toString(), information.getText().toString()); finish(); } }); customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // "Cancel" finish(); } }); // Show the custom action bar view and hide the normal Home icon and title. final ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // END_INCLUDE (inflate_set_custom_view) setContentView(R.layout.activity_done_bar); }
From source file:com.bodeme.easycloud.syncadapter.EnterCredentialsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.enter_credentials, container, false); textUrl = (TextView) v.findViewById(R.id.text_url); // protocol selection spinner textHttpWarning = (TextView) v.findViewById(R.id.http_warning); editURL = (EditText) v.findViewById(R.id.url); editURL.addTextChangedListener(this); editUserName = (EditText) v.findViewById(R.id.userName); editUserName.addTextChangedListener(this); editPassword = (EditText) v.findViewById(R.id.password); editPassword.addTextChangedListener(this); // Remove views for editing ownCloud-url, when constant is given if (Constants.OWNCLOUD_URL != null) { textUrl.setVisibility(View.GONE); editURL.setVisibility(View.GONE); textHttpWarning.setVisibility(View.GONE); }/*w ww. j a va 2s. co m*/ // ownCloud Type Spinner spnrType = (Spinner) v.findViewById(R.id.select_type); spnrType.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { typePosition = position; } @Override public void onNothingSelected(AdapterView<?> parent) { typePosition = 0; } }); spnrType.setSelection(0); // hook into action bar setHasOptionsMenu(true); return v; }
From source file:at.bitfire.davdroid.ui.setup.LoginURLFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.setup_login_url, container, false); // protocol selection spinner textHttpWarning = (TextView) v.findViewById(R.id.http_warning); spnrScheme = (Spinner) v.findViewById(R.id.login_scheme); spnrScheme.setOnItemSelectedListener(new OnItemSelectedListener() { @Override// ww w . j av a 2 s .c o m public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String scheme = parent.getAdapter().getItem(position).toString(); textHttpWarning.setVisibility(scheme.equals("https://") ? View.GONE : View.VISIBLE); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); spnrScheme.setSelection(1); // HTTPS // other input fields editBaseURI = (EditText) v.findViewById(R.id.login_host_path); editBaseURI.addTextChangedListener(this); editUserName = (EditText) v.findViewById(R.id.userName); editUserName.addTextChangedListener(this); editPassword = (EditText) v.findViewById(R.id.password); editPassword.addTextChangedListener(this); checkboxPreemptive = (CheckBox) v.findViewById(R.id.auth_preemptive); // hook into action bar setHasOptionsMenu(true); return v; }