android.arch.lifecycle.MutableLiveData.getValue()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(162)

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

MutableLiveData.getValue介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

private boolean isServerRunning() {
 ShoutingEchoService.Status status=ShoutingEchoService.STATUS.getValue();
 return(status!=null && status.isRunning);
}

代码示例来源:origin: hidroh/materialistic

void setItems(Item[] items) {
    mItems.setValue(Pair.create(mItems.getValue() != null ? mItems.getValue().second : null, items));
  }
}

代码示例来源:origin: hidroh/materialistic

public void refreshStories(String filter, @ItemManager.CacheMode int cacheMode) {
  if (mItems == null || mItems.getValue() == null) {
    return;
  }
  Observable.fromCallable(() -> mItemManager.getStories(filter, cacheMode))
      .subscribeOn(mIoThreadScheduler)
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(items -> setItems(items));
}

代码示例来源:origin: woxingxiao/GracefulMovies

public CityEntity getCityEntity() {
  if (mCity.getValue() != null) {
    return mCity.getValue();
  }
  return null;
}

代码示例来源:origin: anitaa1990/TrailersApp

public boolean isLastPage() {
  return tvsLiveData.getValue() != null &&
      !tvsLiveData.getValue().data.isEmpty() ?
      tvsLiveData.getValue().data.get(0).isLastPage() :
      false;
}

代码示例来源:origin: rsiebert/TVHClient

public void setSelectedTime(long time) {
  if (selectedTime.getValue() != null && selectedTime.getValue() != time) {
    Timber.d("Saving newly selected time");
    selectedTime.setValue(time);
  }
}

代码示例来源:origin: rsiebert/TVHClient

public void setChannelSortOrder(int order) {
  if (channelSortOrder.getValue() != null && channelSortOrder.getValue() != order) {
    Timber.d("Saving newly selected channel sort order");
    channelSortOrder.setValue(order);
  }
}

代码示例来源:origin: SergeyVinyar/AndroidNewArchitectureExample

public void refreshData() {
    cityNameLiveData.setValue(cityNameLiveData.getValue());
  }
}

代码示例来源:origin: kioko/android-liveData-viewModel

public void setSearchQuery(@NonNull String originalInput) {
  String input = originalInput.toLowerCase(Locale.getDefault()).trim();
  if (Objects.equals(input, query.getValue())) {
    return;
  }
  query.setValue(input);
}

代码示例来源:origin: TrustWallet/trust-wallet-android-source

private Uri buildEtherscanUri(Transaction transaction) {
  NetworkInfo networkInfo = defaultNetwork.getValue();
  if (networkInfo != null && !TextUtils.isEmpty(networkInfo.etherscanUrl)) {
    return Uri.parse(networkInfo.etherscanUrl)
        .buildUpon()
        .appendEncodedPath("tx")
        .appendEncodedPath(transaction.hash)
        .build();
  }
  return null;
}

代码示例来源:origin: kioko/android-liveData-viewModel

public void setSearchQuery(@NonNull String originalInput) {
  String input = originalInput.toLowerCase(Locale.getDefault()).trim();
  if (Objects.equals(input, query.getValue())) {
    return;
  }
  query.setValue(input);
}

代码示例来源:origin: TrustWallet/trust-wallet-android-source

public void fetchTokens() {
  progress.postValue(true);
  if (defaultNetwork.getValue() == null) {
    findDefaultNetwork();
  }
  disposable = fetchTokensInteract
      .fetch(wallet.getValue())
      .subscribe(this::onTokens, this::onError);
}

代码示例来源:origin: woxingxiao/GracefulMovies

public void setCity(CityEntity city) {
  if (mCity.getValue() == null || mCity.getValue().getId() != city.getId()) {
    mCity.setValue(city);
  }
}

代码示例来源:origin: TrustWallet/trust-wallet-android-source

public void showMoreDetails(Context context, Transaction transaction) {
  NetworkInfo networkInfo = defaultNetwork.getValue();
  if (networkInfo != null && !TextUtils.isEmpty(networkInfo.etherscanUrl)) {
    Uri uri = Uri.parse(networkInfo.etherscanUrl)
        .buildUpon()
        .appendEncodedPath("tx")
        .appendEncodedPath(transaction.hash)
        .build();
    externalBrowserRouter.open(context, uri);
  }
}

代码示例来源:origin: Piwigo/Piwigo-Android

public void refreshAccounts() {
  Account[] accounts = accountManager.getAccountsByType(resources.getString(R.string.account_type));
  mAllAccounts.setValue(ImmutableList.copyOf(accounts));
  Account a = mCurrentAccount.getValue();
  setActiveAccount(a == null ? "" : a.name);
}

代码示例来源:origin: TrustWallet/trust-wallet-android-source

public void getBalance() {
  balanceDisposable = Observable.interval(0, GET_BALANCE_INTERVAL, TimeUnit.SECONDS)
      .doOnNext(l -> getDefaultWalletBalance
          .get(defaultWallet.getValue())
          .subscribe(defaultWalletBalance::postValue, t -> {}))
      .subscribe();
}

代码示例来源:origin: TrustWallet/trust-wallet-android-source

public void fetchTransactions() {
  progress.postValue(true);
  transactionDisposable = Observable.interval(0, FETCH_TRANSACTIONS_INTERVAL, TimeUnit.SECONDS)
    .doOnNext(l ->
      disposable = fetchTransactionsInteract
          .fetch(defaultWallet.getValue()/*new Wallet("0x60f7a1cbc59470b74b1df20b133700ec381f15d3")*/)
          .subscribe(this::onTransactions, this::onError))
    .subscribe();
}

代码示例来源:origin: TrustWallet/trust-wallet-android-source

private void onDefaultWallet(Wallet wallet) {
  defaultWallet.setValue(wallet);
  if (gasSettings.getValue() == null) {
    onGasSettings(fetchGasSettingsInteract.fetch(confirmationForTokenTransfer));
  }
}

代码示例来源:origin: kioko/android-liveData-viewModel

@VisibleForTesting
public void setMovieId(int movieId) {
  if (Objects.equals(movieId, this.movieId.getValue())) {
    return;
  }
  this.movieId.setValue(movieId);
}

代码示例来源:origin: kioko/android-liveData-viewModel

@VisibleForTesting
public void setPalette(Palette palette) {
  if (Objects.equals(palette, mPalette.getValue())) {
    return;
  }
  mPalette.setValue(palette);
}

相关文章