List of usage examples for android.widget TextView getId
@IdRes @ViewDebug.CapturedViewProperty public int getId()
From source file:io.plaidapp.ui.PlayerActivity.java
@OnClick({ R.id.shot_count, R.id.followers_count, R.id.likes_count }) void playerActionClick(TextView view) { ((AnimatedVectorDrawable) view.getCompoundDrawables()[1]).start(); switch (view.getId()) { case R.id.followers_count: PlayerSheet.start(PlayerActivity.this, player); break;/* ww w .j a va2 s. co m*/ } }
From source file:com.microsoft.office365.msgraphsnippetapp.SnippetDetailFragment.java
private void clipboard(TextView tv) { // which view are we copying to the clipboard? int which;/*from w ww.j av a 2 s . c om*/ switch (tv.getId()) { case txt_request_url: // the url field which = req_url; break; case txt_response_headers: // the display headers which = response_headers; break; case txt_response_body: // the response body which = response_body; break; default: which = UNSET; // don't assign a prefix } // if we know which view we're copying, prefix it with useful info String what = which == UNSET ? "" : getString(which) + " "; // concat the clipboard data to this String what += getString(clippy); // inform the user that data was added to the clipboard Toast.makeText(getActivity(), what, Toast.LENGTH_SHORT).show(); // depending on our API, do it one way or another... if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { // old way ClipboardManager clipboardManager = (ClipboardManager) getActivity() .getSystemService(Context.CLIPBOARD_SERVICE); clipboardManager.setText(tv.getText()); } else { clipboard11(tv); } }
From source file:com.wly.net.PortScannerActivity.java
@Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { boolean result = true; if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_DONE) { // the user is done typing. switch (v.getId()) { case R.id.host_name_text: Toast.makeText(this, "In host_name_text case statement.", Toast.LENGTH_SHORT).show(); host = ((EditText) v).getText().toString(); if (validateUrl(host)) Toast.makeText(this, "The url " + host + " is valid.", Toast.LENGTH_SHORT).show(); if (validateIp(host)) Toast.makeText(this, "The ip address " + host + " is valid.", Toast.LENGTH_SHORT).show(); break; case R.id.port_range_text: parsePorts(((EditText) v).getText().toString()); BaseAdapter adapter = (BaseAdapter) ((PortListFragment) getSupportFragmentManager() .findFragmentById(R.id.port_list_fragment)).getListAdapter(); adapter.notifyDataSetInvalidated(); adapter.notifyDataSetChanged(); break; default:/*w ww . j av a 2 s. com*/ result = false; break; } } return result; // pass on to other listeners. }
From source file:edu.mit.mobile.android.locast.accounts.AuthenticatorActivity.java
@Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { switch (v.getId()) { case R.id.password: handleLogin();//from w ww . j av a 2s . co m return true; } return false; }
From source file:com.microsoft.o365_android_onenote_rest.SnippetDetailFragment.java
private void clipboard(TextView tv) { int which;/* w ww. j a va 2 s .co m*/ switch (tv.getId()) { case txt_request_url: which = req_url; break; case txt_response_headers: which = response_headers; break; case txt_response_body: which = response_body; break; default: which = UNSET; } String what = which == UNSET ? "" : getString(which) + " "; what += getString(clippy); Toast.makeText(getActivity(), what, Toast.LENGTH_SHORT).show(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { // old way ClipboardManager clipboardManager = (ClipboardManager) getActivity() .getSystemService(Context.CLIPBOARD_SERVICE); clipboardManager.setText(tv.getText()); } else { clipboard11(tv); } }
From source file:com.nerderylabs.android.nerdalert.ui.fragment.MainFragment.java
private void persistNametagValues(TextView view) { Context context = getContext(); // stop publishing if the info has changed if (Settings.isPublishing(context)) { nearbyInterface.unpublish(myInfo); nearbyInterface.unsubscribe();/* w w w . java2s .c o m*/ } switch (view.getId()) { case R.id.my_name: myInfo.setName(view.getEditableText().toString()); Settings.setName(context, view.getEditableText().toString()); break; case R.id.my_tagline: myInfo.setTagline(view.getEditableText().toString()); Settings.setTagline(context, view.getEditableText().toString()); break; } Log.d(TAG, "myInfo: " + myInfo); }
From source file:com.sim2dial.dialer.HistorySimpleFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); TextView tv = (TextView) info.targetView.getRootView().findViewById(R.id.rowid); if (tv.getId() == R.id.rowid) { LinphoneActivity.instance().deleteRow(tv.getText().toString()); }//from w ww .ja v a 2s .c o m /* * if (item.getItemId() == R.id.item1) { LinphoneCallLog log = * mLogs.get(info.position); LinphoneManager.getLc().removeCallLog(log); * mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs()); if * (!hideHistoryListAndDisplayMessageIfEmpty()) { * historyList.setAdapter(new CallHistoryAdapter(getActivity())); } } */ return false; }
From source file:edu.mit.mobile.android.locast.accounts.AbsLocastAuthenticatorActivity.java
@Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (v.getId() == R.id.password) { handleLogin();/*from ww w . j a va 2s. c o m*/ return true; } return false; }
From source file:fiskinfoo.no.sintef.fiskinfoo.CardViewFragment.java
private TextView generateTextViewWithText(String text, TextView parent) { TextView textView = new TextView(getActivity()); RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); p.addRule(RelativeLayout.BELOW, parent.getId()); textView.setLayoutParams(p);/* www . j av a 2s. c o m*/ textView.setId(generateRandomId()); textView.setText(text); textView.setPadding(8, 8, 8, 8); textView.setTextColor(Color.parseColor("#666666")); textView.setTextSize(14); return textView; }
From source file:com.esri.arcgisruntime.sample.editfeatureattachments.MainActivity.java
/** * Create a Layout for callout/*w ww.ja va 2 s .co m*/ */ private void createCallout() { // create content text view for the callout mCalloutLayout = new RelativeLayout(getApplicationContext()); TextView calloutContent = new TextView(getApplicationContext()); calloutContent.setId(R.id.calloutTextView); calloutContent.setTextColor(Color.BLACK); calloutContent.setTextSize(18); RelativeLayout.LayoutParams relativeParamsBelow = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); relativeParamsBelow.addRule(RelativeLayout.BELOW, calloutContent.getId()); // create attachment text view for the callout TextView calloutAttachment = new TextView(getApplicationContext()); calloutAttachment.setId(R.id.attchTV); calloutAttachment.setTextColor(Color.BLACK); calloutAttachment.setTextSize(13); calloutContent.setPadding(0, 20, 20, 0); calloutAttachment.setLayoutParams(relativeParamsBelow); RelativeLayout.LayoutParams relativeParamsRightOf = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); relativeParamsRightOf.addRule(RelativeLayout.RIGHT_OF, calloutAttachment.getId()); // create image view for the callout ImageView imageView = new ImageView(getApplicationContext()); imageView.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_info)); imageView.setLayoutParams(relativeParamsRightOf); imageView.setOnClickListener(new ImageViewOnclickListener()); mCalloutLayout.addView(calloutContent); mCalloutLayout.addView(imageView); mCalloutLayout.addView(calloutAttachment); }