List of usage examples for android.text TextUtils equals
public static boolean equals(CharSequence a, CharSequence b)
From source file:com.android.messaging.datamodel.MediaScratchFileProvider.java
public static boolean isMediaScratchSpaceUri(final Uri uri) { if (uri == null) { return false; }// w w w . j a v a 2 s.c o m final List<String> segments = uri.getPathSegments(); return (TextUtils.equals(uri.getScheme(), ContentResolver.SCHEME_CONTENT) && TextUtils.equals(uri.getAuthority(), AUTHORITY) && segments.size() == 1 && FileProvider.isValidFileId(segments.get(0))); }
From source file:com.radiofarda.istgah.utils.MediaIDHelper.java
/** * Determine if media item is playing (matches the currently playing media item). * * @param context for retrieving the {@link MediaControllerCompat} * @param mediaItem to compare to currently playing {@link MediaBrowserCompat.MediaItem} * @return boolean indicating whether media item matches currently playing media item *//* w w w. ja v a2 s . c om*/ public static boolean isMediaItemPlaying(Context context, MediaBrowserCompat.MediaItem mediaItem) { // Media item is considered to be playing or paused based on the controller's current // media id MediaControllerCompat controller = ((FragmentActivity) context).getSupportMediaController(); if (controller != null && controller.getMetadata() != null) { String currentPlayingMediaId = controller.getMetadata().getDescription().getMediaId(); String itemMusicId = mediaItem.getDescription().getMediaId(); if (currentPlayingMediaId != null && TextUtils.equals(currentPlayingMediaId, itemMusicId)) { return true; } } return false; }
From source file:com.classiqo.nativeandroid_32bitz.model.MutableMediaMetadata.java
@Override public boolean equals(Object o) { if (this == o) { return true; }//ww w . j a v a 2s.c o m if (o == null || o.getClass() != MutableMediaMetadata.class) { return false; } MutableMediaMetadata that = (MutableMediaMetadata) o; return TextUtils.equals(trackId, that.trackId); }
From source file:com.example.android.uamp.model.MutableMediaMetadataCompat.java
@Override public boolean equals(Object o) { if (this == o) { return true; }//from w w w . ja va2 s . c o m if (o == null || o.getClass() != MutableMediaMetadataCompat.class) { return false; } MutableMediaMetadataCompat that = (MutableMediaMetadataCompat) o; return TextUtils.equals(trackId, that.trackId); }
From source file:com.appdevper.mediaplayer.model.MutableMediaMetadata.java
@Override public boolean equals(Object o) { if (this == o) { return true; }// w w w . j a v a 2 s. c om if (o == null || o.getClass() != MutableMediaMetadata.class) { return false; } MutableMediaMetadata that = (MutableMediaMetadata) o; return TextUtils.equals(trackId, that.trackId); }
From source file:com.android.switchaccess.SwitchAccessPreferenceActivity.java
/** * Check if option scanning is enabled//from w ww. j ava2s .co m * * @param context The current context * @return {@code true} if option scanning is enabled in the preferences, {@code false} * otherwise */ public static boolean isOptionScanningEnabled(Context context) { String optionScanKey = context.getString(R.string.option_scanning_key); String scanPref = SharedPreferencesUtils.getSharedPreferences(context).getString( context.getString(R.string.pref_scanning_methods_key), context.getString(R.string.pref_scanning_methods_default)); return TextUtils.equals(scanPref, optionScanKey); }
From source file:com.google.blockly.model.FieldLabel.java
/** * Sets the text for this label. Changes to the label will not be serialized by Blockly and * should not be caused by user input. For user editable text fields use * {@link FieldInput} instead./*from w ww.j av a 2s.c o m*/ */ public void setText(String text) { if (!TextUtils.equals(text, mText)) { mText = text; } }
From source file:com.google.android.apps.muzei.SourcePackageChangeReceiver.java
@Override public void onReceive(Context context, Intent intent) { if (intent == null || intent.getData() == null) { return;/*from w ww . j a v a 2 s . com*/ } String packageName = intent.getData().getSchemeSpecificPart(); SourceManager sourceManager = SourceManager.getInstance(context); ComponentName selectedComponent = sourceManager.getSelectedSource(); if (!TextUtils.equals(packageName, selectedComponent.getPackageName())) { return; } try { context.getPackageManager().getServiceInfo(selectedComponent, 0); } catch (PackageManager.NameNotFoundException e) { LOGI(TAG, "Selected source no longer available; switching to default."); sourceManager.selectDefaultSource(); return; } // Some other change. LOGI(TAG, "Source package changed or replaced. Re-subscribing."); sourceManager.subscribeToSelectedSource(); }
From source file:com.citrus.sdk.payment.PaymentOption.java
public static PaymentOption fromJSONObject(JSONObject walletObject) { PaymentOption paymentOption = null;/*from w w w . jav a2 s . com*/ String type = walletObject.optString("type"); String name = walletObject.optString("name"); String token = walletObject.optString("token"); String cardHolderName = walletObject.optString("owner"); String expiry = walletObject.optString("expiryDate"); String cardNumber = walletObject.optString("number"); String cardScheme = walletObject.optString("scheme"); if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(token)) { if (TextUtils.equals("credit", type)) { paymentOption = new CreditCardOption(name, token, cardHolderName, cardNumber, CardScheme.getCardScheme(cardScheme), expiry); } else if (TextUtils.equals("debit", type)) { paymentOption = new DebitCardOption(name, token, cardHolderName, cardNumber, CardScheme.getCardScheme(cardScheme), expiry); } else { String bankName = walletObject.optString("bank"); paymentOption = new NetbankingOption(name, token, bankName); } } return paymentOption; }
From source file:com.battlelancer.seriesguide.extensions.ExtensionPackageChangeReceiver.java
@Override public void onReceive(Context context, Intent intent) { if (intent == null || intent.getData() == null) { return;//w ww. j ava 2 s.c o m } String changedPackage = intent.getData().getSchemeSpecificPart(); ExtensionManager extensionManager = ExtensionManager.getInstance(context); List<ComponentName> enabledExtensions = extensionManager.getEnabledExtensions(); int affectedExtensionIndex = -1; for (int i = 0; i < enabledExtensions.size(); i++) { ComponentName componentName = enabledExtensions.get(i); if (TextUtils.equals(changedPackage, componentName.getPackageName())) { affectedExtensionIndex = i; break; } } if (affectedExtensionIndex == -1) { return; } // temporarily unsubscribe from extension ComponentName changedExtension = enabledExtensions.remove(affectedExtensionIndex); extensionManager.setEnabledExtensions(enabledExtensions); try { context.getPackageManager().getServiceInfo(changedExtension, 0); } catch (PackageManager.NameNotFoundException e) { Timber.i(e, "Extension no longer available: removed"); return; } // changed or updated Timber.i("Extension package changed or replaced: re-subscribing"); enabledExtensions.add(affectedExtensionIndex, changedExtension); extensionManager.setEnabledExtensions(enabledExtensions); }