List of usage examples for android.widget TextView equals
public boolean equals(Object obj)
From source file:ca.psiphon.ploggy.FragmentComposeMessage.java
@Override public boolean onEditorAction(TextView textView, int actionId, KeyEvent event) { if (textView.equals(mContentEdit) && actionId == EditorInfo.IME_ACTION_SEND) { addNewMessage();/*from w ww.j a v a 2 s.c o m*/ return true; } return false; }
From source file:kiv.janecekz.ma.ToneFragment.java
@Override public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) { if (arg0.equals(input) && (arg1 == EditorInfo.IME_ACTION_DONE)) { boolean b = pl.setFreq(Float.parseFloat(((SpannableStringBuilder) arg0.getText()).toString())); if (!b) { arg0.setText(Float.toString(pl.getFreq())); } else {/*w w w . j a v a2 s.c om*/ pl.togglePlay(); // FIXME: What if only push the enter? if (actualFreqView != null) { actualFreqView.setTextColor(getView().getResources().getColor(R.color.blue)); actualFreqView = null; } } } return true; }
From source file:com.al70b.core.extended_widgets.SlidingTabLayout.java
private void scrollToTab(int tabIndex, int positionOffset) { final int tabStripChildCount = mTabStrip.getChildCount(); if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) { return;/* w w w. j a va 2 s .c o m*/ } View selectedChild = mTabStrip.getChildAt(tabIndex); if (selectedChild != null) { int targetScrollX = selectedChild.getLeft() + positionOffset; if (tabIndex > 0 || positionOffset > 0) { // If we're not at the first child and are mid-scroll, make sure we obey the offset targetScrollX -= mTitleOffset; } scrollTo(targetScrollX, 0); // Handle tabs coloring if (selectedChild instanceof TextView) { TextView prev = (TextView) mTabStrip.getChildAt(mTabStrip.getPreviousPosition()); if (!prev.equals(selectedChild)) prev.setTextColor(getResources().getColor(android.R.color.darker_gray)); ((TextView) selectedChild).setTextColor(getResources().getColor(R.color.white)); } else if (selectedChild instanceof LinearLayout) { return; } } }
From source file:com.cerema.cloud2.authentication.AuthenticatorActivity.java
/** * Called when the 'action' button in an IME is pressed ('enter' in software keyboard). * //from w w w .j a v a 2 s . c o m * Used to trigger the authentication check when the user presses 'enter' after writing the * password, or to throw the server test when the only field on screen is the URL input field. */ @Override public boolean onEditorAction(TextView inputField, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE && inputField != null && inputField.equals(mPasswordInput)) { if (mOkButton.isEnabled()) { mOkButton.performClick(); } } else if (actionId == EditorInfo.IME_ACTION_NEXT && inputField != null && inputField.equals(mHostUrlInput)) { if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()) .equals(mAuthTokenType)) { checkOcServer(); } } return false; // always return false to grant that the software keyboard is hidden anyway }
From source file:com.owncloud.android.authentication.AuthenticatorActivity.java
/** * Called when the 'action' button in an IME is pressed ('enter' in software * keyboard)./*from w w w . java 2 s. c om*/ * * Used to trigger the authentication check when the user presses 'enter' * after writing the password, or to throw the server test when the only * field on screen is the URL input field. */ @Override public boolean onEditorAction(TextView inputField, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE && inputField != null && inputField.equals(mPasswordInput)) { if (mOkButton.isEnabled()) { mOkButton.performClick(); } } else if (actionId == EditorInfo.IME_ACTION_NEXT && inputField != null && inputField.equals(mHostUrlInput)) { if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType)) { checkOcServer(); } } return false; // always return false to grant that the software keyboard // is hidden anyway }
From source file:com.mdlive.sav.MDLiveSearchProvider.java
/** * Instantiating array adapter to populate the listView * The layout android.R.layout.simple_list_item_single_choice creates radio button for each listview item * * @param list : Dependent users array list *//*from ww w .j a v a2s . c o m*/ private void showListViewDialog(final ArrayList<String> list, final TextView selectedText, final String key, final ArrayList<HashMap<String, String>> typeList) { /*We need to get the instance of the LayoutInflater*/ final AlertDialog.Builder alertDialog = new AlertDialog.Builder(MDLiveSearchProvider.this); LayoutInflater inflater = getLayoutInflater(); View convertView = inflater.inflate(R.layout.mdlive_screen_popup, null); alertDialog.setView(convertView); ListView lv = (ListView) convertView.findViewById(R.id.popupListview); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list); lv.setAdapter(adapter); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); final AlertDialog dialog = alertDialog.create(); dialog.show(); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String SelectedText = list.get(position); HashMap<String, String> localMap = typeList.get(position); for (Map.Entry entry : localMap.entrySet()) { if (SelectedText.equals(entry.getValue().toString())) { postParams.put(key, entry.getKey().toString()); break; //breaking because its one to one map } } specialityBasedOnProvider(SelectedText, key); String oldChoice = selectedText.getText().toString(); selectedText.setText(SelectedText); dialog.dismiss(); // if user selects a different Provider type, then reload this screen if (!oldChoice.equals(SelectedText)) { SharedPreferences sharedpreferences = getSharedPreferences( PreferenceConstants.MDLIVE_USER_PREFERENCES, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(PreferenceConstants.PROVIDER_MODE, SelectedText); int providerType = MDLiveConfig.PROVIDERTYPE_MAP.get(SelectedText) == null ? MDLiveConfig.UNMAPPED : MDLiveConfig.PROVIDERTYPE_MAP.get(SelectedText); if (providerType == MDLiveConfig.UNMAPPED) editor.putString(PreferenceConstants.PROVIDERTYPE_ID, ""); else editor.putString(PreferenceConstants.PROVIDERTYPE_ID, String.valueOf(providerType)); editor.commit(); // now reload the screen //recreate(); } } }); }
From source file:edu.umbc.cs.ebiquity.mithril.parserapp.contentparsers.contacts.ContactDetailFragment.java
/** * Builds a phone number LinearLayout based on phone number info from the Contacts Provider. * Each phone number gets its own LinearLayout object; for example, if the contact * has three phone numbers, then 3 LinearLayouts are generated. * * @param addressType From/*w ww .jav a 2 s .co m*/ * {@link android.provider.ContactsContract.CommonDataKinds.StructuredPostal#TYPE} * @param addressTypeLabel From * {@link android.provider.ContactsContract.CommonDataKinds.StructuredPostal#LABEL} * @param address From * {@link android.provider.ContactsContract.CommonDataKinds.StructuredPostal#FORMATTED_ADDRESS} * @return A LinearLayout to add to the contact details layout, * populated with the provided phone details. */ private LinearLayout buildPhoneLayout(String phoneNumber, int phoneType) { // Inflates the phone number layout final LinearLayout phoneLayout = (LinearLayout) LayoutInflater.from(getActivity()) .inflate(R.layout.contact_phone_item, mPhoneLayout, false); // Gets handles to the view objects in the layout final TextView headerTextView = (TextView) phoneLayout.findViewById(R.id.contact_phone_header); final TextView phoneTextView = (TextView) phoneLayout.findViewById(R.id.contact_phone_item); final ImageButton dialNumberButton = (ImageButton) phoneLayout.findViewById(R.id.button_call_number); // If there's no phone number for the contact, shows the empty view and message, and hides the // header and button. if (phoneNumber == null && phoneType == 0) { headerTextView.setText(""); dialNumberButton.setVisibility(View.GONE); phoneTextView.setText(R.string.no_address); } else { headerTextView.setText("Phone Number"); phoneTextView.setText(phoneNumber); // add PhoneStateListener PhoneCallListener phoneListener = new PhoneCallListener(); TelephonyManager telephonyManager = (TelephonyManager) getActivity() .getSystemService(Context.TELEPHONY_SERVICE); telephonyManager.listen(phoneListener, PhoneStateListener.LISTEN_CALL_STATE); // Defines an onClickListener object for the call number button dialNumberButton.setOnClickListener(new View.OnClickListener() { // Defines what to do when users click the address button @Override public void onClick(View view) { Intent dialIntent = null; if (!phoneTextView.equals("")) { Uri number = Uri.parse("tel:" + phoneTextView.getText()); // Log.v(ParserApplication.getDebugTag(), "Calling the number: "+number.toString()); dialIntent = new Intent(Intent.ACTION_CALL, number); startActivity(dialIntent); } // A PackageManager instance is needed to verify that there's a default app // that handles ACTION_VIEW and a geo Uri. final PackageManager packageManager = getActivity().getPackageManager(); // Checks for an activity that can handle this intent. Preferred in this // case over Intent.createChooser() as it will still let the user choose // a default (or use a previously set default) for geo Uris. if (packageManager.resolveActivity(dialIntent, PackageManager.MATCH_DEFAULT_ONLY) != null) { startActivity(dialIntent); } else { // If no default is found, displays a message that no activity can handle // the view button. Toast.makeText(getActivity(), R.string.no_intent_found, Toast.LENGTH_SHORT).show(); } } }); } return phoneLayout; }