Example usage for android.text TextUtils equals

List of usage examples for android.text TextUtils equals

Introduction

In this page you can find the example usage for android.text TextUtils equals.

Prototype

public static boolean equals(CharSequence a, CharSequence b) 

Source Link

Document

Returns true if a and b are equal, including if they are both null.

Usage

From source file:com.citrus.sdk.fragments.Netbanking.java

private void initListener() {
    onNetbankfetched = new JSONTaskComplete() {
        @Override//from  w w  w  .  java 2  s . c o m
        public void onTaskExecuted(JSONObject[] options, String message) {

            try {
                if (!TextUtils.equals(message, "success")) {
                    Toast.makeText(getActivity().getApplicationContext(),
                            "Check your net connection or vanity url", Toast.LENGTH_LONG).show();
                } else {
                    JSONArray array = options[0].getJSONArray("netBanking");
                    myOptions.storeBanks(array);
                    initBanks();
                }

            } catch (JSONException e) {
                return;
            }

        }
    };
}

From source file:com.taobao.weex.ui.flat.FlatGUIContext.java

public boolean promoteToView(@NonNull WXComponent component, boolean checkAncestor,
        @NonNull Class<? extends WXComponent<?>> expectedClass) {
    return !isFlatUIEnabled(component) || !expectedClass.equals(component.getClass())
            || TextUtils.equals(component.getRef(), WXDomObject.ROOT)
            || (checkAncestor && getFlatComponentAncestor(component) == null) || checkComponent(component);
}

From source file:com.granita.tasks.model.Model.java

@Override
public boolean equals(Object o) {
    if (!(o instanceof Model)) {
        return false;
    }//from w  ww .ja  v a  2  s. c  om
    Class<?> otherClass = o.getClass();
    Class<?> myClass = getClass();

    return myClass.equals(otherClass) && TextUtils.equals(mAccountType, ((Model) o).mAccountType);
}

From source file:com.jparkie.aizoban.views.adapters.BaseFragmentStatePagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    // If we already have this item instantiated, there is nothing
    // to do.  This can happen when we are restoring the entire pager
    // from its saved state, where the fragment manager has already
    // taken care of restoring the fragments we previously had instantiated.
    if (mFragments.size() > position) {
        Fragment f = mFragments.get(position);
        if (f != null) {
            return f;
        }/* w  w w. j  a  va  2 s.  co  m*/
    }
    if (mCurTransaction == null) {
        mCurTransaction = mFragmentManager.beginTransaction();
    }
    Fragment fragment = getItem(position);
    String fragmentTag = getTag(position);
    if (DEBUG)
        Log.v(TAG, "Adding item #" + position + ": f=" + fragment);
    if (mSavedState.size() > position) {
        String savedTag = mSavedFragmentTags.get(position);
        if (TextUtils.equals(fragmentTag, savedTag)) {
            Fragment.SavedState fss = mSavedState.get(position);
            if (fss != null) {
                fragment.setInitialSavedState(fss);
            }
        }
    }
    while (mFragments.size() <= position) {
        mFragments.add(null);
    }
    fragment.setMenuVisibility(false);
    fragment.setUserVisibleHint(false);
    mFragments.set(position, fragment);
    mCurTransaction.add(container.getId(), fragment, fragmentTag);
    return fragment;
}

From source file:com.classiqo.nativeandroid_32bitz.utils.MediaIDHelper.java

public static boolean isMediaItemPlaying(Context context, MediaBrowserCompat.MediaItem mediaItem) {
    MediaControllerCompat controller = ((FragmentActivity) context).getSupportMediaController();

    if (controller != null && controller.getMetadata() != null) {
        String currentPlayingMediaId = controller.getMetadata().getDescription().getMediaId();
        String itemMusicId = MediaIDHelper.extractMusicIDFromMediaID(mediaItem.getDescription().getMediaId());

        if (currentPlayingMediaId != null && TextUtils.equals(currentPlayingMediaId, itemMusicId)) {
            return true;
        }/*from  w  w w  .  j  a v  a  2s . c  o m*/
    }
    return false;
}

From source file:com.citrus.sdk.fragments.DebitCard.java

private void initSubmitButton() {
    submitButton.setOnClickListener(new OnClickListener() {

        @Override/*from   w w w  .ja va 2s  .com*/
        public void onClick(View v) {
            initValues();
            if (isValidCard()) {
                if (TextUtils.equals(paymentType, Constants.GUEST_FLOW)) {
                    createUser();
                } else {
                    savePayOption();
                }
                getSignature();
            }
        }
    });
}

From source file:com.bluros.updater.service.UpdateCheckService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (TextUtils.equals(intent.getAction(), ACTION_CANCEL_CHECK)) {
        ((UpdateApplication) getApplicationContext()).getQueue().cancelAll(TAG);
        return START_NOT_STICKY;
    }/*  ww  w. j  av a 2s  .co  m*/

    return super.onStartCommand(intent, flags, startId);
}

From source file:com.google.android.apps.forscience.whistlepunk.metadata.TriggerHelper.java

/**
 * Adds the trigger ID to the layout's active triggers if it is not already in the list.
 */// w  ww. jav  a  2 s .  c  o  m
public static void addTriggerToLayoutActiveTriggers(GoosciSensorLayout.SensorLayout layout, String triggerId) {
    int oldSize = layout.activeSensorTriggerIds.length;
    for (int i = 0; i < oldSize; i++) {
        if (TextUtils.equals(layout.activeSensorTriggerIds[i], triggerId)) {
            // Then is it already in the list, no need to add it again.
            return;
        }
    }
    String[] newTriggerIds = new String[oldSize + 1];
    System.arraycopy(layout.activeSensorTriggerIds, 0, newTriggerIds, 0, layout.activeSensorTriggerIds.length);
    newTriggerIds[oldSize] = triggerId;
    layout.activeSensorTriggerIds = newTriggerIds;
}

From source file:com.oldsneerjaw.sleeptimer.PauseMusicNotifierTest.java

public void testPostNotification() {
    notifier.postNotification();/*from w  w w . j a v a  2  s. c  o  m*/

    Mockito.verify(mockNotificationManager).notify(Mockito.eq(NOTIFICATION_ID),
            Mockito.argThat(new BaseMatcher<Notification>() {
                @Override
                public boolean matches(Object o) {
                    if (!(o instanceof Notification)) {
                        return false;
                    }

                    Notification candidate = (Notification) o;

                    return TextUtils.equals(NOTIFICATION_TITLE, candidate.tickerText)
                            && (candidate.icon == R.drawable.ic_launcher)
                            && (candidate.priority == NotificationCompat.PRIORITY_DEFAULT)
                            && (candidate.contentIntent != null)
                            && ((candidate.flags & Notification.FLAG_AUTO_CANCEL) != 0);
                }

                @Override
                public void describeTo(Description description) {
                    // Describe the notification that was expected in the event of test failure
                    description.appendText(
                            "a notification with the correct title, icon, default priority, a pending intent and set to auto cancel");
                }
            }));
}

From source file:com.citrus.sdk.fragments.SavedOptions.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    returnView = inflater.inflate(R.layout.activity_saved_options, container, false);
    listener = new JSONTaskComplete() {

        @Override/*from  w w  w .j  a  va2  s  .  co  m*/
        public void onTaskExecuted(JSONObject[] returnObject, String message) {
            progressBar.setVisibility(View.INVISIBLE);
            if (TextUtils.equals(message, "success")) {
                initViews();
                try {
                    storePayOptions(returnObject[1]);
                    showPayOptions();
                } catch (Exception e) {
                    return;
                }
            } else {
                Logout.logoutUser(getActivity());
                showSignInFlow("User not signed in");
            }
        }

    };

    signInListener = new JSONTaskComplete() {

        @Override
        public void onTaskExecuted(JSONObject[] paymentObject, String message) {
            progressBar.setVisibility(View.INVISIBLE);
            if (TextUtils.equals(message, "signedIn")) {
                showSavedOptions();
            } else {
                showSignInFlow("User not signed in");
            }
        }
    };

    showSavedOptions();
    return returnView;
}