List of usage examples for java.lang CharSequence equals
public boolean equals(Object obj)
From source file:org.onehippo.cms7.essentials.dashboard.utils.JavaSourceUtils.java
@SuppressWarnings({ UNCHECKED, RAWTYPES }) private static void addImport(final CompilationUnit unit, final AST ast, final CharSequence importName) { final List imports = unit.imports(); for (Object anImport : imports) { final ImportDeclaration declaration = (ImportDeclaration) anImport; final String fullyQualifiedName = declaration.getName().getFullyQualifiedName(); if (importName.equals(fullyQualifiedName)) { log.debug("Import already exists, skipping {}", fullyQualifiedName); return; }/*from w w w . j av a2 s . c o m*/ } final ImportDeclaration essentialsImportDeclaration = ast.newImportDeclaration(); essentialsImportDeclaration.setName(ast.newName(DOT_SPLITTER.split(importName))); imports.add(essentialsImportDeclaration); }
From source file:com.stimulus.archiva.language.NGramProfile.java
/** * Add ngrams from a single word in this profile * * @param word is the word to add//from w ww .j a v a 2s .c om * @param n is the ngram size */ private void add(CharSequence cs) { if (cs.equals(SEP_CHARSEQ)) { return; } NGramEntry nge = (NGramEntry) ngrams.get(cs); if (nge == null) { nge = new NGramEntry(cs); ngrams.put(cs, nge); } nge.inc(); }
From source file:sms.spam.NewSmsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_sms_layout); final AutoCompleteTextView autocompleteContact = (AutoCompleteTextView) findViewById( R.id.autocompleteContact);//w w w . ja v a2 s. c om contactsCursorAdapter = new SimpleCursorAdapter(this, R.layout.autocomplete, null, new String[] { ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER }, new int[] { R.id.autocompleteText, R.id.autocompleteNumber }, 0); final ContactsLoader loader = new ContactsLoader(this); getSupportLoaderManager().initLoader(ContactsLoader.CONTACTS, null, loader); getSupportLoaderManager().initLoader(ContactsLoader.NUMBERS, null, loader); contactsCursorAdapter.setFilterQueryProvider(new FilterQueryProvider() { @Override public Cursor runQuery(final CharSequence constraint) { if (getSupportLoaderManager().hasRunningLoaders()) { return null; } return new CursorWrapper(loader.getCursor(ContactsLoader.NUMBERS)) { int pos, count; int[] indexes; { this.pos = 0; if (!constraint.equals("")) { this.indexes = new int[super.getCount()]; this.count = 0; for (int i = 0, j = 0; i < super.getCount(); ++i) { super.moveToPosition(i); if (super.getString(0).contains(constraint) || super.getString(1).contains(constraint)) { this.indexes[j++] = i; this.count++; } } } else { this.count = super.getCount(); this.indexes = new int[this.count]; for (int i = 0; i < count; ++i) { this.indexes[i] = i; } } } @Override public boolean move(int offset) { return this.moveToPosition(this.pos + offset); } @Override public boolean moveToNext() { return this.moveToPosition(this.pos + 1); } @Override public boolean moveToPrevious() { return this.moveToPosition(this.pos - 1); } @Override public boolean moveToFirst() { return this.moveToPosition(0); } @Override public boolean moveToLast() { return this.moveToPosition(this.count - 1); } @Override public boolean moveToPosition(int position) { if (position < 0 || position >= count) { return false; } this.pos = indexes[position]; return super.moveToPosition(this.pos); } @Override public int getCount() { return this.count; } @Override public int getPosition() { return this.pos; } @Override public void close() { } }; } }); autocompleteContact.setAdapter(contactsCursorAdapter); autocompleteContact.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapter, View view, int index, long id) { Cursor cursor = (Cursor) adapter.getItemAtPosition(index); autocompleteContact.setText(cursor.getString(1)); } }); // autocompleteContact.setAdapter(new ArrayAdapter<String> // (this, R.layout.autocomplete, new String[] {"alfa", "beta", "gamma"})); }
From source file:com.android.talkback.eventprocessor.ProcessorScreen.java
private boolean isAlertDialog(int windowId) { CharSequence className = mWindowToClassName.get(windowId); return className != null && className.equals("android.app.AlertDialog"); }
From source file:hku.fyp14017.blencode.ui.fragment.AddBrickFragment.java
private void clickedOnUserBrick(final UserBrick clickedBrick, View view) { final Context context = getActivity(); final List<CharSequence> items = new ArrayList<CharSequence>(); items.add(context.getText(hku.fyp14017.blencode.R.string.brick_context_dialog_add_to_script)); items.add(context.getText(hku.fyp14017.blencode.R.string.brick_context_dialog_edit_brick)); AlertDialog.Builder builder = new AlertDialog.Builder(context); boolean drawingCacheEnabled = view.isDrawingCacheEnabled(); view.setDrawingCacheEnabled(true);// www . j a va 2 s. co m view.setDrawingCacheBackgroundColor(Color.TRANSPARENT); view.buildDrawingCache(true); if (view.getDrawingCache() != null) { Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache()); view.setDrawingCacheEnabled(drawingCacheEnabled); ImageView imageView = getGlowingBorder(bitmap); builder.setCustomTitle(imageView); } builder.setItems(items.toArray(new CharSequence[items.size()]), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { CharSequence clickedItemText = items.get(item); if (clickedItemText.equals( context.getText(hku.fyp14017.blencode.R.string.brick_context_dialog_add_to_script))) { addBrickToScript(clickedBrick); } else if (clickedItemText .equals(context.getText(hku.fyp14017.blencode.R.string.brick_context_dialog_edit_brick))) { launchBrickScriptActivityOnBrick(context, clickedBrick); } } }); AlertDialog alertDialog = builder.create(); alertDialog.show(); }
From source file:org.egov.android.view.activity.RegisterActivity.java
/** * It is used to initialize an activity. An Activity is an application component that provides a * screen with which users can interact in order to do something, To initialize the * RegisterActivity.Set click listener to the save button. *//* w w w . j a v a 2 s .c o m*/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); ((Button) findViewById(R.id.register_doRegister)).setOnClickListener(this); ((Button) findViewById(R.id.btngotit)).setOnClickListener(this); sharedpreferences = getApplicationContext().getSharedPreferences(getString(R.string.app_name), 0); // 0 - for private mode if (AndroidLibrary.getInstance().getConfig().get("api.multicities", "false").equals("true")) { isMulticity = true; Spinner citydropdown = (Spinner) findViewById(R.id.citydropdown); if (isInternetAvailable()) { new getCitiesFromURL(RegisterActivity.this, citydropdown) .execute(AndroidLibrary.getInstance().getConfig().getString("app.citiesJsonUrl")); } else { Toast.makeText(getApplicationContext(), "No Internet Connection!", Toast.LENGTH_LONG).show(); this.finish(); } } else { ((LinearLayout) findViewById(R.id.citydropdowncontainer)).setVisibility(View.GONE); baseServerURL = sharedpreferences.getString("api.baseUrl", null); } LinearLayout viewpwd = (LinearLayout) findViewById(R.id.passwordmsgcontainer); if (!sharedpreferences.getBoolean("register.pwdinfo", false)) { ((TextView) findViewById(R.id.passwordmsg)).setText(getPasswordConstraintInformation()); viewpwd.setVisibility(View.VISIBLE); } else { viewpwd.setVisibility(View.GONE); } //name validation ((EditText) findViewById(R.id.register_name)).setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence src, int start, int end, Spanned dst, int dstart, int dend) { if (src.equals("")) { // for backspace return src; } if (src.toString().matches("[a-zA-Z ]+")) { return src; } return ""; } } }); }
From source file:eu.iescities.pilot.rovereto.roveretoexplorer.fragments.event.EventDetailsFragment.java
@Override public void onStart() { super.onStart(); if (mEvent != null) { // title/*from ww w . ja va 2s .c o m*/ TextView tv = (TextView) this.getView().findViewById(R.id.event_details_title); tv.setText(mEvent.getTitle()); /* * BUTTONS */ // follow/unfollow // if (mStart) { // ToggleButton followTbtn = (ToggleButton) // this.getView().findViewById(R.id.event_details_follow_tbtn); // if // (getEvent().getCommunityData().getFollowing().containsKey(DTHelper.getUserId())) // { // followTbtn.setBackgroundResource(R.drawable.ic_btn_monitor_on); // followTbtn.setChecked(true); // } else { // followTbtn.setBackgroundResource(R.drawable.ic_btn_monitor_off); // followTbtn.setChecked(false); // } // // followTbtn.setOnCheckedChangeListener(new // OnCheckedChangeListener() { // @Override // public void onCheckedChanged(CompoundButton buttonView, boolean // isChecked) { // if (!mCanceledFollow) { // if (isChecked) { // // FOLLOW // { // SCAsyncTask<Object, Void, BaseDTObject> followTask = new // SCAsyncTask<Object, Void, BaseDTObject>( // getActivity(), new FollowAsyncTaskProcessor(getActivity(), // buttonView)); // followTask.execute(mEvent); // } // } else { // // UNFOLLOW // SCAsyncTask<BaseDTObject, Void, BaseDTObject> unfollowTask = new // SCAsyncTask<BaseDTObject, Void, BaseDTObject>( // getActivity(), new UnfollowAsyncTaskProcessor(getActivity(), // buttonView)); // unfollowTask.execute(mEvent); // // } // } else { // mCanceledFollow = false; // } // } // }); // } // // // attend // ToggleButton attendTbtn = (ToggleButton) // this.getView().findViewById(R.id.event_details_attend_tbtn); // if (getEvent().getAttending() == null || // getEvent().getAttending().isEmpty()) { // attendTbtn.setBackgroundResource(R.drawable.ic_btn_monitor_off); // attendTbtn.setChecked(false); // } else { // attendTbtn.setBackgroundResource(R.drawable.ic_btn_monitor_on); // attendTbtn.setChecked(true); // } // // attendTbtn.setOnCheckedChangeListener(new // OnCheckedChangeListener() { // @Override // public void onCheckedChanged(CompoundButton buttonView, boolean // isChecked) { // // if (new // // AMSCAccessProvider().isUserAnonymous(getActivity())) // // { // // // show dialog box // // UserRegistration.upgradeuser(getActivity()); // // } else // { // new SCAsyncTask<Boolean, Void, LocalExplorerObject>(getActivity(), // new AttendProcessor( // getActivity(), buttonView)).execute(getEvent().getAttending() == // null // || getEvent().getAttending().isEmpty()); // } // } // }); // map ImageButton mapBtn = (ImageButton) getView().findViewById(R.id.event_details_map); mapBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mEvent.getLocation() != null) { ArrayList<BaseDTObject> list = new ArrayList<BaseDTObject>(); getEvent().setLocation(mEvent.getLocation()); list.add(getEvent()); MapManager.switchToMapView(list, mFragment); } else { Toast.makeText(getActivity(), R.string.toast_poi_not_found, Toast.LENGTH_SHORT).show(); } } }); // directions ImageButton directionsBtn = (ImageButton) getView().findViewById(R.id.event_details_directions); directionsBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mEvent.getLocation() != null) { bringMeThere(getEvent()); } else { Toast.makeText(getActivity(), R.string.toast_poi_not_found, Toast.LENGTH_SHORT).show(); } } }); /* * END BUTTONS */ // location tv = (TextView) this.getView().findViewById(R.id.event_details_loc); // POIObject poi = getPOI(); if (mEvent.getCustomData() != null && mEvent.getCustomData().get("place") != null) { //esegui get address information tv.setText((CharSequence) mEvent.getCustomData().get("place")); } else { ((LinearLayout) this.getView().findViewById(R.id.eventdetails)).removeView(tv); } // description, optional tv = (TextView) this.getView().findViewById(R.id.event_details_descr); String customDesc = mEvent.getDescription(); if (customDesc != null && customDesc.length() > 0) { tv.setText(Html.fromHtml(customDesc)); } else { ((LinearLayout) this.getView().findViewById(R.id.eventdetails)).removeView(tv); } // notes tv = (TextView) this.getView().findViewById(R.id.event_details_notes); // if (mEvent.getCommunityData() != null && // mEvent.getCommunityData().getNotes() != null // && mEvent.getCommunityData().getNotes().length() > 0) { // tv.setText(mEvent.getCommunityData().getNotes()); // } else { ((LinearLayout) this.getView().findViewById(R.id.eventdetails)).removeView(tv); // } // tags tv = (TextView) this.getView().findViewById(R.id.event_details_tags); if (mEvent.getCommunityData() != null && mEvent.getCommunityData().getTags() != null && mEvent.getCommunityData().getTags().size() > 0) { String tags = new String(); for (String s : mEvent.getCommunityData().getTags()) { tags += s + "\t"; } tv.setText(tags); } else { ((LinearLayout) this.getView().findViewById(R.id.eventdetails)).removeView(tv); } // date tv = (TextView) this.getView().findViewById(R.id.event_details_date); if (mEvent.getFromTime() != null && mEvent.getFromTime() > 0) { CharSequence fromTime = mEvent.dateTimeString(); CharSequence toTime = mEvent.toDateTimeString(); if (fromTime.equals(toTime)) { tv.setText(fromTime); } else { tv.setText(fromTime + " - " + toTime); } } else { tv.setText(""); } commentsHandler = new CommentsHandler(getEvent(), getActivity(), getView()); } }
From source file:org.jtheque.primary.impl.dao.DaoSimpleDatas.java
/** * Return all the simple datas of the primary impl. * * @param impl The primary implementation. * * @return A Collection containing all the simple datas of the primary implementation. *//*from ww w . ja v a2 s . co m*/ private Collection<SimpleData> getAll(CharSequence impl) { if (StringUtils.isEmpty(impl) || dataType.isPrimary()) { return getAll(); } load(); Collection<SimpleData> simpleDatas = new ArrayList<SimpleData>(getCache().size() / 2); for (SimpleData simpleData : getCache().values()) { PrimarySimpleData primarySimpleData = (PrimarySimpleData) simpleData; if (impl.equals(primarySimpleData.getPrimaryImpl())) { simpleDatas.add(primarySimpleData); } } return simpleDatas; }
From source file:org.apache.nutch.analysis.lang.NGramProfile.java
/** * Add ngrams from a single word in this profile * * @param word is the word to add/* w ww.ja va 2 s . co m*/ * @param n is the ngram size */ private void add(CharSequence cs) { if (cs.equals(SEP_CHARSEQ)) { return; } NGramEntry nge = ngrams.get(cs); if (nge == null) { nge = new NGramEntry(cs); ngrams.put(cs, nge); } nge.inc(); }
From source file:android.support.design.widget.CollapsingTextHelper.java
/** * Set the title to display/* w ww. j a v a2 s . c o m*/ * * @param text */ void setText(CharSequence text) { if (text == null || !text.equals(mText)) { mText = text; mTextToDraw = null; clearTexture(); recalculate(); } }