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.google.blockly.model.FieldInput.java

/**
 * Sets the current text in this Field.//from  w  w w  . j av  a  2 s  .  c  om
 *
 * @param text The text to replace the field content with.
 */
public void setText(String text) {
    if (!TextUtils.equals(text, mText)) {
        String oldText = mText;
        mText = text;
        fireValueChanged(oldText, text);
    }
}

From source file:com.citrus.sdk.operations.OneClicksignup.java

public void initListeners() {
    listener = new JSONTaskComplete() {
        @Override//from   w  w w  .j  a va 2 s  .c om
        public void onTaskExecuted(JSONObject[] paymentObject, String message) {
            if (TextUtils.equals(message, "success")) {
                if (TextUtils.equals(type, "netbanking")) {
                    savebankOption(paymentDetails);
                } else {
                    saveCardOption(paymentDetails);
                }
            }

        }
    };

    messenger = new Messenger() {
        @Override
        public void onTaskExecuted(String result) {
            if (TextUtils.equals(result, "success")) {

                if (TextUtils.equals(type, "netbanking")) {
                    savebankOption(paymentDetails);
                } else {
                    saveCardOption(paymentDetails);
                }

            }
        }
    };
}

From source file:com.dgsd.android.ShiftTracker.Service.NotificationService.java

@Override
protected void onHandleIntent(final Intent inIntent) {
    final String action = inIntent.getAction();
    if (TextUtils.isEmpty(action)) {
        return;//from   w w w. ja  v a  2 s  . co  m
    }

    if (TextUtils.equals(action, ACTION_SHOW_ALARM)) {
        final Shift shift = inIntent.getParcelableExtra(EXTRA_SHIFT);
        if (shift != null && shift.id != -1) {
            showAlarmNotification(shift);
        }
    }
}

From source file:com.google.android.marvin.mytalkback.formatter.TouchExplorationSystemUiFormatter.java

@Override
public boolean format(AccessibilityEvent event, TalkBackService context, Utterance utterance) {
    final CharSequence recordText = getRecordText(context, event);

    // Don't populate with empty text. This should never happen!
    if (TextUtils.isEmpty(recordText)) {
        return false;
    }/*from  w w w  .j a va 2  s .c o m*/

    // Don't speak the same utterance twice.
    if (TextUtils.equals(mLastUtteranceText, recordText)) {
        return false;
    }

    utterance.addSpoken(recordText);
    utterance.addHaptic(R.id.patterns_hover);
    utterance.addAuditory(R.id.sounds_hover);

    mLastUtteranceText.clear();
    mLastUtteranceText.append(recordText);

    return true;
}

From source file:com.android.talkback.formatter.TouchExplorationSystemUiFormatter.java

@Override
public boolean format(AccessibilityEvent event, TalkBackService context, Utterance utterance) {
    final SpannableStringBuilder recordText = new SpannableStringBuilder();
    final List<CharSequence> entries = AccessibilityEventCompat.getRecord(event, 0).getText();

    // Reverse the entries so that time is read aloud first.
    Collections.reverse(entries);

    for (final CharSequence entry : entries) {
        StringBuilderUtils.appendWithSeparator(recordText, entry);
    }/*w w w. j av a2  s  .  co  m*/

    // Don't populate with empty text. This should never happen!
    if (TextUtils.isEmpty(recordText))
        return false;

    // Don't speak the same utterance twice.
    if (TextUtils.equals(mLastUtteranceText, recordText))
        return false;

    utterance.addSpoken(recordText);
    utterance.addHaptic(R.array.view_hovered_pattern);
    utterance.addAuditory(R.raw.focus);

    mLastUtteranceText.clear();
    mLastUtteranceText.append(recordText);

    return true;
}

From source file:com.android.screenspeak.formatter.TouchExplorationSystemUiFormatter.java

@Override
public boolean format(AccessibilityEvent event, ScreenSpeakService context, Utterance utterance) {
    final SpannableStringBuilder recordText = new SpannableStringBuilder();
    final List<CharSequence> entries = AccessibilityEventCompat.getRecord(event, 0).getText();

    // Reverse the entries so that time is read aloud first.
    Collections.reverse(entries);

    for (final CharSequence entry : entries) {
        StringBuilderUtils.appendWithSeparator(recordText, entry);
    }/*w ww. ja  v a  2 s .c  o m*/

    // Don't populate with empty text. This should never happen!
    if (TextUtils.isEmpty(recordText))
        return false;

    // Don't speak the same utterance twice.
    if (TextUtils.equals(mLastUtteranceText, recordText))
        return false;

    utterance.addSpoken(recordText);
    utterance.addHaptic(R.array.view_hovered_pattern);
    utterance.addAuditory(R.raw.focus);

    mLastUtteranceText.clear();
    mLastUtteranceText.append(recordText);

    return true;
}

From source file:com.android.providers.contacts.LocaleSet.java

public static boolean isLocaleSimplifiedChinese(Locale locale) {
    // language must match
    if (locale == null || !TextUtils.equals(locale.getLanguage(), CHINESE_LANGUAGE)) {
        return false;
    }/*from  w  w  w.  j av  a 2 s.com*/

    // script is optional but if present must match
    if (!TextUtils.isEmpty(ICUCompat.maximizeAndGetScript(locale))) {
        return ICUCompat.maximizeAndGetScript(locale).equals(SCRIPT_SIMPLIFIED_CHINESE);
    }
    // if no script, must match known country
    return locale.equals(Locale.SIMPLIFIED_CHINESE);
}

From source file:com.yibingding.haolaiwu.ViewPagerActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    Intent in = getIntent();/*from ww w. j a  va 2 s . com*/
    String string = in.getStringExtra("type");
    if (TextUtils.equals("", string)) {
        adinfos = in.getParcelableArrayListExtra("adinfos");
        Log.e("=============", "===========adinfos.size()===" + adinfos.size());
    } else {
        list = in.getStringArrayListExtra("list");
        Log.e("=============", "========list.size()==" + list.size());
    }
    int position = getIntent().getIntExtra("position", 0);

    mViewPager = new HackyViewPager(this);
    mViewPager.setBackgroundColor(getResources().getColor(R.color.black));
    setContentView(mViewPager);

    mViewPager.setAdapter(new SamplePagerAdapter());
    mViewPager.setCurrentItem(position);
}

From source file:com.citrus.sdk.webops.SignUpAsynch.java

@Override
protected String doInBackground(String... params) {
    String result = null;/*from   w  w  w.j  ava  2  s  .c  om*/
    mobileClient = new MobileClient(this.activity, Constants.CITRUS_OAUTH_URL);
    subscriptionService = mobileClient.getSubscriptionService(Constants.SIGNUP_KEY, Constants.SIGNUP_SECRET,
            Constants.SIGNIN_ID, Constants.SIGNIN_SECRET);

    try {
        subscriptionService.signup(params[0], params[1], params[2], params[3], params[4]);
        result = "success";
    } catch (ProtocolException e) {
        e.printStackTrace();
        result = "failure";
    } catch (OAuth2Exception e) {
        e.printStackTrace();
        result = "failure";
    } catch (SubscriptionException e) {
        try {
            if (TextUtils.equals(Constants.USER_EXISTS, e.getContent().getString("type"))) {
                result = e.getContent().getString("type");
            }
        } catch (JSONException ex) {

        }
        e.printStackTrace();
    } catch (JSONException e) {
        e.printStackTrace();
        result = "failure";
    }

    return result;
}

From source file:de.medienDresden.illumina.activity.PreferenceActivity.java

@Override
public void refreshTheme() {
    final String possiblyUpdatedTheme = getPreferences().getString(Illumina.PREF_THEME,
            getString(R.string.theme_default));

    if (!TextUtils.equals(mCurrentTheme, possiblyUpdatedTheme)) {
        finish();/*from   w w w.  java 2s . c  om*/
        startActivity(new Intent(this, getClass()));
    }
}