Java Code Examples for com.facebook.internal.Utility#stringsEqualOrEmpty()

The following examples show how to use com.facebook.internal.Utility#stringsEqualOrEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlacePickerFragment.java    From platform-friends-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}
 
Example 2
Source File: PlacePickerFragment.java    From Klyph with MIT License 6 votes vote down vote up
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}
 
Example 3
Source File: KlyphPlacePickerFragment.java    From Klyph with MIT License 6 votes vote down vote up
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean  forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}
 
Example 4
Source File: PlacePickerFragment.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}
 
Example 5
Source File: PlacePickerFragment.java    From android-skeleton-project with MIT License 6 votes vote down vote up
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}
 
Example 6
Source File: PlacePickerFragment.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}
 
Example 7
Source File: PlacePickerFragment.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}
 
Example 8
Source File: PlacePickerFragment.java    From Abelana-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}
 
Example 9
Source File: PlacePickerFragment.java    From KlyphMessenger with MIT License 6 votes vote down vote up
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}
 
Example 10
Source File: PlacePickerFragment.java    From facebook-api-android-maven with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}
 
Example 11
Source File: PlacePickerFragment.java    From HypFacebook with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}
 
Example 12
Source File: PlacePickerFragment.java    From FacebookNewsfeedSample-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the search text and reloads the data in the control. This is used to provide search-box
 * functionality where the user may be typing or editing text rapidly. It uses a timer to avoid repeated
 * requerying, preferring to wait until the user pauses typing to refresh the data. Note that this
 * method will NOT update the text in the search box, if any, as it is intended to be called as a result
 * of changes to the search box (and is public to enable applications to provide their own search box
 * UI instead of the default one).
 *
 * @param searchText                 the search text
 * @param forceReloadEventIfSameText if true, will reload even if the search text has not changed; if false,
 *                                   identical search text will not force a reload
 */
public void onSearchBoxTextChanged(String searchText, boolean forceReloadEventIfSameText) {
    if (!forceReloadEventIfSameText && Utility.stringsEqualOrEmpty(this.searchText, searchText)) {
        return;
    }

    if (TextUtils.isEmpty(searchText)) {
        searchText = null;
    }
    this.searchText = searchText;

    // If search text is being set in response to user input, it is wasteful to send a new request
    // with every keystroke. Send a request the first time the search text is set, then set up a 2-second timer
    // and send whatever changes the user has made since then. (If nothing has changed
    // in 2 seconds, we reset so the next change will cause an immediate re-query.)
    hasSearchTextChangedSinceLastQuery = true;
    if (searchTextTimer == null) {
        searchTextTimer = createSearchTextTimer();
    }
}