com.facebook.internal.Utility.stringsEqualOrEmpty()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中com.facebook.internal.Utility.stringsEqualOrEmpty()方法的一些代码示例,展示了Utility.stringsEqualOrEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utility.stringsEqualOrEmpty()方法的具体详情如下:
包路径:com.facebook.internal.Utility
类名称:Utility
方法名:stringsEqualOrEmpty

Utility.stringsEqualOrEmpty介绍

暂无

代码示例

代码示例来源:origin: facebook/facebook-android-sdk

/**
 * 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();
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

/**
 * Sets and sends registration id to register the current app for push notifications.
 * @param registrationId RegistrationId received from FCM.
 */
public static void setPushNotificationsRegistrationId(String registrationId) {
  synchronized (staticLock) {
    if (!Utility.stringsEqualOrEmpty(pushNotificationsRegistrationId, registrationId))
    {
      pushNotificationsRegistrationId = registrationId;
      AppEventsLogger logger = AppEventsLogger.newLogger(
          FacebookSdk.getApplicationContext());
      // Log implicit push token event and flush logger immediately
      logger.logEvent(AppEventsConstants.EVENT_NAME_PUSH_TOKEN_OBTAINED);
      if (AppEventsLogger.getFlushBehavior() !=
          AppEventsLogger.FlushBehavior.EXPLICIT_ONLY) {
        logger.flush();
      }
    }
  }
}

代码示例来源:origin: fr.avianey/facebook-android-api

/**
 * 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();
  }
}

相关文章