List of usage examples for java.lang CharSequence equals
public boolean equals(Object obj)
From source file:org.cowboycoders.cyclisimo.fragments.ChooseActivityDialogFragment.java
/** * Gets the display info./* www. ja va2 s. c o m*/ */ private List<DisplayInfo> getDisplayInfos() { List<DisplayInfo> displayInfos = new ArrayList<DisplayInfo>(); Intent intent = ShareCompat.IntentBuilder.from(activity).setType(IntentUtils.TEXT_PLAIN_TYPE).getIntent(); List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); if (resolveInfos != null && resolveInfos.size() > 0) { int size = resolveInfos.size(); ResolveInfo firstResolveInfo = resolveInfos.get(0); for (int i = 1; i < size; i++) { ResolveInfo resolveInfo = resolveInfos.get(i); if (firstResolveInfo.priority != resolveInfo.priority || firstResolveInfo.isDefault != resolveInfo.isDefault) { while (i < size) { resolveInfos.remove(i); size--; } } } if (size > 1) { ResolveInfo.DisplayNameComparator displayNameComparator = new ResolveInfo.DisplayNameComparator( packageManager); Collections.sort(resolveInfos, displayNameComparator); } firstResolveInfo = resolveInfos.get(0); int start = 0; CharSequence firstLabel = firstResolveInfo.loadLabel(packageManager); for (int i = 1; i < size; i++) { if (firstLabel == null) { firstLabel = firstResolveInfo.activityInfo.packageName; } ResolveInfo resolveInfo = resolveInfos.get(i); CharSequence label = resolveInfo.loadLabel(packageManager); if (label == null) { label = resolveInfo.activityInfo.packageName; } if (label.equals(firstLabel)) { continue; } processGroup(resolveInfos, displayInfos, start, i - 1); firstResolveInfo = resolveInfo; firstLabel = label; start = i; } // Process last group processGroup(resolveInfos, displayInfos, start, size - 1); } return displayInfos; }
From source file:com.lamcreations.scaffold.common.utils.CollapsingTextHelper.java
public void setText(CharSequence text) { if (text == null || !text.equals(this.mText)) { this.mText = text; this.mTextToDraw = null; this.clearTexture(); this.recalculate(); }/*w w w.j ava2 s.c om*/ }
From source file:org.jtheque.primary.impl.dao.DaoPersons.java
/** * Return all the persons of the specified type. * * @param type The searched type./*from www . j av a 2s .co m*/ * * @return Return a Collection containing all the persons of the specified type. */ private Collection<Person> getAll(CharSequence type) { if (StringUtils.isEmpty(type)) { return getAll(); } load(); Collection<Person> persons = new ArrayList<Person>(getCache().size() / 3); for (Person person : getCache().values()) { if (type.equals(person.getType())) { persons.add(person); } } return persons; }
From source file:com.esminis.server.library.activity.main.MainViewImpl.java
@Override public void setPort(String port, boolean valid) { final CharSequence portOld = viewPort.getText().toString(); if (!portOld.equals(port)) { viewPort.setText(port);//from w ww.j a v a2 s. c o m } viewPort.setTextColor(valid ? Color.BLACK : Color.RED); }
From source file:net.sourceforge.servestream.fragment.NowPlayingFragment.java
private void updateNowPlaying() { if (mNowPlayingView == null) { return;// w ww . j a v a 2s . c om } try { if (true && mService != null && mService.getAudioId() != -1) { Drawable d = null; SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); if (preferences.getBoolean(PreferenceConstants.RETRIEVE_ALBUM_ART, false)) { long id = mService.getAudioId(); if (id >= 0) { Bitmap b = BitmapFactory.decodeResource(getActivity().getResources(), R.drawable.albumart_mp_unknown_list); BitmapDrawable defaultAlbumIcon = new BitmapDrawable(getActivity().getResources(), b); // no filter or dither, it's a lot faster and we can't tell the difference defaultAlbumIcon.setFilterBitmap(false); defaultAlbumIcon.setDither(false); d = MusicUtils.getCachedArtwork(getActivity(), mService.getAudioId(), defaultAlbumIcon, true); } } if (d == null) { mCoverart.setVisibility(View.GONE); } else { mCoverart.setVisibility(View.VISIBLE); mCoverart.setImageDrawable(d); } mTitle.setSelected(true); mArtist.setSelected(true); CharSequence trackName = mService.getTrackName(); CharSequence artistName = mService.getArtistName(); if (trackName == null || trackName.equals(Media.UNKNOWN_STRING)) { mTitle.setText(R.string.widget_one_track_info_unavailable); } else { mTitle.setText(trackName); } if (artistName == null || artistName.equals(Media.UNKNOWN_STRING)) { artistName = mService.getMediaUri(); } mArtist.setText(artistName); if (mPreviousButton != null) { mPreviousButton.setImageResource(R.drawable.btn_player_prev); mPreviousButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { mService.prev(); } catch (RemoteException e) { } } }); } mPauseButton.setVisibility(View.VISIBLE); if (mService.isPlaying()) { mPauseButton.setImageResource(R.drawable.btn_playerpreview_pause); } else { mPauseButton.setImageResource(R.drawable.btn_playerpreview_play); } mPauseButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { if (mService.isPlaying()) { mService.pause(); } else { mService.play(); } } catch (RemoteException e) { } } }); if (mNextButton != null) { mNextButton.setImageResource(R.drawable.btn_player_next); mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { mService.next(); } catch (RemoteException e) { } } }); } if (mNowPlayingView.getVisibility() != View.VISIBLE) { Animation fade_in = AnimationUtils.loadAnimation(getActivity(), R.anim.player_in); mNowPlayingView.startAnimation(fade_in); } mNowPlayingView.setVisibility(View.VISIBLE); mNowPlayingView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Context c = v.getContext(); c.startActivity(new Intent(c, MediaPlayerActivity.class)); } }); return; } } catch (RemoteException ex) { } Animation fade_out = AnimationUtils.loadAnimation(getActivity(), R.anim.player_out); mNowPlayingView.startAnimation(fade_out); mNowPlayingView.setVisibility(View.GONE); }
From source file:net.sourceforge.servestream.fragment.MiniControllerFragment.java
private void updateNowPlaying() { if (mNowPlayingView == null) { return;//from w w w . j av a2s .co m } try { if (true && mService != null && mService.getAudioId() != -1) { long id = -1; SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); if (preferences.getBoolean(PreferenceConstants.RETRIEVE_ALBUM_ART, false)) { id = mService.getAudioId(); } if (id == -1) { //mCoverart.setVisibility(View.GONE); } else { mImageFetcher.loadImage(id, mCoverart); mCoverart.setVisibility(View.VISIBLE); } mTitle.setSelected(true); mArtist.setSelected(true); CharSequence trackName = mService.getTrackName(); CharSequence artistName = mService.getArtistName(); if (trackName == null || trackName.equals(Media.UNKNOWN_STRING)) { mTitle.setText(R.string.widget_one_track_info_unavailable); } else { mTitle.setText(trackName); } if (artistName == null || artistName.equals(Media.UNKNOWN_STRING)) { artistName = mService.getMediaUri(); } mArtist.setText(artistName); if (mPreviousButton != null) { mPreviousButton.setImageResource(Utils.getThemedIcon(getActivity(), R.attr.ic_av_previous)); mPreviousButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { mService.prev(); } catch (RemoteException e) { } } }); } mPauseButton.setVisibility(View.VISIBLE); if (mService.isPlaying()) { mPauseButton .setImageResource(Utils.getThemedIcon(getActivity(), R.attr.ic_mini_controller_pause)); } else { mPauseButton .setImageResource(Utils.getThemedIcon(getActivity(), R.attr.ic_mini_controller_play)); } mPauseButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { if (mService.isPlaying()) { mService.pause(); } else { mService.play(); } } catch (RemoteException e) { } } }); if (mNextButton != null) { mNextButton.setImageResource(Utils.getThemedIcon(getActivity(), R.attr.ic_av_next)); mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { mService.next(); } catch (RemoteException e) { } } }); } if (mNowPlayingView.getVisibility() != View.VISIBLE) { Animation fade_in = AnimationUtils.loadAnimation(getActivity(), R.anim.player_in); mNowPlayingView.startAnimation(fade_in); } mNowPlayingView.setVisibility(View.VISIBLE); mNowPlayingView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Context c = v.getContext(); c.startActivity(new Intent(c, MediaPlayerActivity.class)); } }); return; } } catch (RemoteException ex) { } Animation fade_out = AnimationUtils.loadAnimation(getActivity(), R.anim.player_out); mNowPlayingView.startAnimation(fade_out); mNowPlayingView.setVisibility(View.GONE); }
From source file:eu.trentorise.smartcampus.trentinofamiglia.fragments.event.EventDetailsFragment.java
@Override public void onStart() { super.onStart(); if (mEvent != null) { ImageView certifiedIcon = (ImageView) this.getView().findViewById(R.id.event_details_icon); ImageView bannerCertifiedIcon = (ImageView) this.getView().findViewById(R.id.banner_certified); if (CategoryHelper.CAT_EVENT_ESTATE_GIOVANI_E_FAMIGLIA.equals(mEvent.getType()) && mEvent.isCertified()) { bannerCertifiedIcon.setVisibility(View.VISIBLE); //// w w w . jav a2 s .c o m } certifiedIcon.setImageDrawable(ExplorerObject.getIconsEventCertified(getActivity(), mEvent)); // title TextView tv = (TextView) this.getView().findViewById(R.id.event_details_title); tv.setText(mEvent.getTitle()); /* * BUTTONS */ // 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(); } } }); if (mEvent.getLocation()[0] == 0 && mEvent.getLocation()[1] == 0) { mapBtn.setVisibility(View.INVISIBLE); directionsBtn.setVisibility(View.GONE); } /* * 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); } // timing tv = (TextView) this.getView().findViewById(R.id.event_timing); if (getEvent().getTiming() != null && mEvent.getTiming().length() > 0) { tv.setText(mEvent.getTimingFormatted()); } 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.customDescription(getActivity()); 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) { tv.setText(Utils.conceptToSimpleString(mEvent.getCommunityData().getTags())); } 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:cn.ttyhuo.activity.InfoOwnerActivity.java
private void saveParams(Boolean resetOld) { Map<String, String> tmpParams = new HashMap<String, String>(); tmpParams.put("licensePlate", mEditChepai.getText().toString()); Integer sIndex = 0;/* ww w . j a v a 2 s. co m*/ Integer tmpIndex = 0; for (CharSequence s : ConstHolder.TruckTypeItems) { tmpIndex++; if (s.equals(mEditChexing.getText().toString())) { sIndex = tmpIndex; break; } } tmpParams.put("truckType", sIndex.toString()); tmpParams.put("loadLimit", mEditZaizhong.getText().toString()); tmpParams.put("truckLength", mEditChechang.getText().toString()); tmpParams.put("modelNumber", mEditXinghao.getText().toString()); tmpParams.put("seatingCapacity", mEditZuowei.getText().toString()); tmpParams.put("releaseYear", mEditDate.getText().toString().replace("", "")); tmpParams.put("truckWidth", mEditKuan.getText().toString()); tmpParams.put("truckHeight", mEditGao.getText().toString()); if (resetOld) oldParams = tmpParams; else params = tmpParams; }
From source file:com.groksolutions.grok.mobile.chart.AbstractAnomalyChartFragment.java
protected void updateName(final View parent, final AnomalyChartData data) { final TextView textView = (TextView) parent.findViewById(R.id.name); if (textView != null) { final CharSequence oldName = textView.getText(); if (data == null) { textView.setText(null);//from w w w . ja va 2 s . c o m textView.setSelected(false); } else if (!oldName.equals(data.getName())) { textView.setText(data.getName()); textView.setSelected(true); } parent.forceLayout(); } }
From source file:org.catrobat.catroid.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(R.string.brick_context_dialog_add_to_script)); items.add(context.getText(R.string.brick_context_dialog_edit_brick)); AlertDialog.Builder builder = new AlertDialog.Builder(context); boolean drawingCacheEnabled = view.isDrawingCacheEnabled(); view.setDrawingCacheEnabled(true);//from www . j a va 2s . com 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(R.string.brick_context_dialog_add_to_script))) { addBrickToScript(clickedBrick); } else if (clickedItemText.equals(context.getText(R.string.brick_context_dialog_edit_brick))) { launchBrickScriptActivityOnBrick(context, clickedBrick); } } }); AlertDialog alertDialog = builder.create(); alertDialog.show(); }