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.rascarlo.aurdroid.ui.SearchFragment.java

private void bindKeyWords() {
    if (context != null) {
        String sharedPreferenceSearchBy = AurdroidSharedPreferences.getSharedPreferenceString(context,
                getString(R.string.key_search_by), getString(R.string.key_search_by_default_value));
        if (TextUtils.equals(sharedPreferenceSearchBy, getString(R.string.key_search_by_name_or_description))) {
            radioButtonSearchByNameOrDescription.setChecked(true);
        } else if (TextUtils.equals(sharedPreferenceSearchBy, getString(R.string.key_search_by_name))) {
            radioButtonSearchByName.setChecked(true);
        } else if (TextUtils.equals(sharedPreferenceSearchBy, getString(R.string.key_search_by_maintainer))) {
            radioButtonSearchByMaintainer.setChecked(true);
        } else if (TextUtils.equals(sharedPreferenceSearchBy, getString(R.string.key_search_by_depends))) {
            radioButtonSearchByDepends.setChecked(true);
        } else if (TextUtils.equals(sharedPreferenceSearchBy, getString(R.string.key_search_by_make_depends))) {
            radioButtonSearchByMakeDepends.setChecked(true);
        } else if (TextUtils.equals(sharedPreferenceSearchBy, getString(R.string.key_search_by_opt_depends))) {
            radioButtonSearchByOptDepends.setChecked(true);
        } else if (TextUtils.equals(sharedPreferenceSearchBy,
                getString(R.string.key_search_by_check_depends))) {
            radioButtonSearchByCheckDepends.setChecked(true);
        } else {/*from w w w  .  j av a2  s .  c o m*/
            radioButtonSearchByNameOrDescription.setChecked(true);
        }
    }
}

From source file:com.bayapps.android.robophish.ui.MusicPlayerActivity.java

private void navigateToBrowser(String title, String subtitle, String mediaId) {
    LogHelper.d(TAG, "navigateToBrowser, mediaId=" + mediaId);
    MediaBrowserFragment fragment = getBrowseFragment();

    if (fragment == null || !TextUtils.equals(fragment.getMediaId(), mediaId)) {
        fragment = new MediaBrowserFragment();
        fragment.setMediaId(title, subtitle, mediaId);
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        transaction.setCustomAnimations(R.animator.slide_in_from_right, R.animator.slide_out_to_left,
                R.animator.slide_in_from_left, R.animator.slide_out_to_right);
        transaction.replace(R.id.container, fragment, FRAGMENT_TAG);
        // If this is not the top level media (root), we add it to the fragment back stack,
        // so that actionbar toggle and Back will work appropriately:
        if (mediaId != null) {
            transaction.addToBackStack(null);
        }//from   w  ww .j  a v a 2s.c om
        transaction.commit();
    }
}

From source file:com.gh4a.activities.IssueListActivity.java

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

    String state = getIntent().getStringExtra(Constants.Issue.STATE);
    if (TextUtils.equals(state, Constants.Issue.STATE_CLOSED)) {
        getPager().setCurrentItem(1);/*from  w  w  w .  ja  v  a2  s.c  om*/
    }

    if (savedInstanceState != null) {
        mSearchQuery = savedInstanceState.getString(STATE_KEY_SEARCH_QUERY);
        mSearchMode = savedInstanceState.getBoolean(STATE_KEY_SEARCH_MODE);
    }

    if (Gh4Application.get().isAuthorized()) {
        CoordinatorLayout rootLayout = getRootLayout();
        mCreateFab = (FloatingActionButton) getLayoutInflater().inflate(R.layout.add_fab, rootLayout, false);
        mCreateFab.setOnClickListener(this);
        rootLayout.addView(mCreateFab);
    }

    getSupportLoaderManager().initLoader(3, null, mIsCollaboratorCallback);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(R.string.issues);
    actionBar.setSubtitle(mRepoOwner + "/" + mRepoName);
    actionBar.setDisplayHomeAsUpEnabled(true);
}

From source file:com.chinaftw.music.CastPlayback.java

private void loadMedia(String mediaId, boolean autoPlay)
        throws TransientNetworkDisconnectionException, NoConnectionException, JSONException {
    String musicId = MediaIDHelper.extractMusicIDFromMediaID(mediaId);
    android.media.MediaMetadata track = mMusicProvider.getMusic(musicId);
    if (!TextUtils.equals(mediaId, mCurrentMediaId)) {
        mCurrentMediaId = mediaId;/*from w ww .ja va2 s  .co m*/
        mCurrentPosition = 0;
    }
    JSONObject customData = new JSONObject();
    customData.put(ITEM_ID, mediaId);
    MediaInfo media = toCastMediaMetadata(track, customData);
    mCastManager.loadMedia(media, autoPlay, mCurrentPosition, customData);
}

From source file:com.android.inputmethod.accessibility.AccessibilityUtils.java

/**
 * Obtains a description for an auto-correction key, taking into account the
 * currently typed word and auto-correction.
 *
 * @param keyCodeDescription spoken description of the key that will insert
 *            an auto-correction//from   ww  w.  j av  a  2s .c o m
 * @param shouldObscure whether the key should be obscured
 * @return a description including a description of the auto-correction, if
 *         needed
 */
public String getAutoCorrectionDescription(final String keyCodeDescription, final boolean shouldObscure) {
    if (!TextUtils.isEmpty(mAutoCorrectionWord)) {
        if (!TextUtils.equals(mAutoCorrectionWord, mTypedWord)) {
            if (shouldObscure) {
                // This should never happen, but just in case...
                return mContext.getString(R.string.spoken_auto_correct_obscured, keyCodeDescription);
            }
            return mContext.getString(R.string.spoken_auto_correct, keyCodeDescription, mTypedWord,
                    mAutoCorrectionWord);
        }
    }

    return keyCodeDescription;
}

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

private void initiateTxn() {
    taskExecuted = new JSONTaskComplete() {

        @Override//from w  ww.  j av  a  2s. c o m
        public void onTaskExecuted(JSONObject[] paymentObject, String message) {
            if (TextUtils.equals(message, "success")) {
                try {
                    String url = paymentObject[0].getString("redirectUrl");
                    Intent intent = new Intent(getActivity().getApplicationContext(), Web3DSecure.class);
                    intent.putExtra("redirectUrl", url);
                    startActivity(intent);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }

    };
    new Pay(getActivity(), paymentObject, taskExecuted).execute();
}

From source file:com.jtechme.apphub.views.fragments.AppListFragment.java

public void updateSearchQuery(@Nullable String query) {
    if (!TextUtils.equals(query, searchQuery)) {
        searchQuery = query;//from  w  w w.  j  a  va2 s  .co  m
        if (isAdded()) {
            getLoaderManager().restartLoader(0, null, this);
        }
    }
}

From source file:android.support.v17.leanback.widget.DetailsOverviewSharedElementHelper.java

void setSharedElementEnterTransition(Activity activity, String sharedElementName, long timeoutMs) {
    if (activity == null && !TextUtils.isEmpty(sharedElementName)
            || activity != null && TextUtils.isEmpty(sharedElementName)) {
        throw new IllegalArgumentException();
    }//from  ww  w  .  j av a 2s. c o m
    if (activity == mActivityToRunTransition && TextUtils.equals(sharedElementName, mSharedElementName)) {
        return;
    }
    if (mActivityToRunTransition != null) {
        ActivityCompat.setEnterSharedElementCallback(mActivityToRunTransition, null);
    }
    mActivityToRunTransition = activity;
    mSharedElementName = sharedElementName;
    if (DEBUG) {
        Log.d(TAG, "postponeEnterTransition " + mActivityToRunTransition);
    }
    ActivityCompat.setEnterSharedElementCallback(mActivityToRunTransition, this);
    ActivityCompat.postponeEnterTransition(mActivityToRunTransition);
    if (timeoutMs > 0) {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                if (mStartedPostpone) {
                    return;
                }
                if (DEBUG) {
                    Log.d(TAG, "timeout " + mActivityToRunTransition);
                }
                startPostponedEnterTransition();
            }
        }, timeoutMs);
    }
}

From source file:com.torrenttunes.android.CastPlayback.java

private void loadMedia(String mediaId, boolean autoPlay)
        throws TransientNetworkDisconnectionException, NoConnectionException, JSONException {
    String musicId = MediaIDHelper.extractMusicIDFromMediaID(mediaId);
    MediaMetadataCompat track = mMusicProvider.getMusic(musicId);
    if (!TextUtils.equals(mediaId, mCurrentMediaId)) {
        mCurrentMediaId = mediaId;/*ww  w  . j  a va2 s.c om*/
        mCurrentPosition = 0;
    }
    JSONObject customData = new JSONObject();
    customData.put(ITEM_ID, mediaId);
    MediaInfo media = toCastMediaMetadata(track, customData);
    mCastManager.loadMedia(media, autoPlay, mCurrentPosition, customData);
}

From source file:android.support.v7.testutils.TestUtilsMatchers.java

/**
 * Returns a matcher that matches data entry in <code>SQLiteCursor</code> that has
 * the specified text in the specified column.
 *///from w ww .j  a va 2  s.c  om
public static Matcher<Object> withCursorItemContent(final String columnName, final String expectedText) {
    return new BoundedMatcher<Object, SQLiteCursor>(SQLiteCursor.class) {
        @Override
        public void describeTo(Description description) {
            description.appendText("doesn't match " + expectedText);
        }

        @Override
        protected boolean matchesSafely(SQLiteCursor cursor) {
            return TextUtils.equals(expectedText, cursor.getString(cursor.getColumnIndex(columnName)));
        }
    };
}