当前位置: 首页>>代码示例>>Java>>正文


Java ObservableInt类代码示例

本文整理汇总了Java中android.databinding.ObservableInt的典型用法代码示例。如果您正苦于以下问题:Java ObservableInt类的具体用法?Java ObservableInt怎么用?Java ObservableInt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ObservableInt类属于android.databinding包,在下文中一共展示了ObservableInt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SSLessonsViewModel

import android.databinding.ObservableInt; //导入依赖的package包/类
public SSLessonsViewModel(Context context, DataListener dataListener, String ssQuarterlyIndex) {
    this.context = context;
    this.dataListener = dataListener;
    this.ssQuarterlyIndex = ssQuarterlyIndex;

    mDatabase = FirebaseDatabase.getInstance().getReference();
    mDatabase.keepSynced(true);

    ssLessonsLoadingVisibility = new ObservableInt(View.INVISIBLE);
    ssLessonsEmptyStateVisibility = new ObservableInt(View.INVISIBLE);
    ssLessonsErrorStateVisibility = new ObservableInt(View.INVISIBLE);
    ssLessonsCoordinatorVisibility = new ObservableInt(View.INVISIBLE);

    shared = PreferenceManager.getDefaultSharedPreferences(context);

    loadQuarterlyInfo();
}
 
开发者ID:Adventech,项目名称:sabbath-school-android,代码行数:18,代码来源:SSLessonsViewModel.java

示例2: takeTakesCorrectTimes

import android.databinding.ObservableInt; //导入依赖的package包/类
@Test
public void takeTakesCorrectTimes() throws Exception {
    int int1 = 123;
    int int2 = 32;
    ObservableInt observed = new ObservableInt(int1);
    ObservableInt observing = Cinder.computeInt(()->
                    observed.get()
            , observed).take(2).immediate();
    assertTrue(observing.get() == int1);

    observed.set(int2);
    assertTrue(observing.get() == int2);

    observed.set(int1);
    assertTrue(observing.get() == int2);
}
 
开发者ID:akiraspeirs,项目名称:Cinder,代码行数:17,代码来源:CinderIntUnitTest.java

示例3: skipSkipsCorrectTimes

import android.databinding.ObservableInt; //导入依赖的package包/类
@Test
public void skipSkipsCorrectTimes() throws Exception {
    int int1 = 123;
    int int2 = 32;
    ObservableInt observed = new ObservableInt();
    ObservableInt observing = Cinder.computeInt(()->
                    observed.get()
            , observed).skip(1);

    observed.set(int1);
    assertTrue(observing.get() == 0);

    observed.set(int2);
    assertTrue(observing.get() == int2);

    observed.set(int1);
    assertTrue(observing.get() == int1);
}
 
开发者ID:akiraspeirs,项目名称:Cinder,代码行数:19,代码来源:CinderIntUnitTest.java

示例4: RepositoryViewModel

import android.databinding.ObservableInt; //导入依赖的package包/类
public RepositoryViewModel(Context context, final Repository repository) {
    this.repository = repository;
    this.context = context;
    this.ownerName = new ObservableField<>();
    this.ownerEmail = new ObservableField<>();
    this.ownerLocation = new ObservableField<>();
    this.ownerLayoutVisibility = new ObservableInt(View.INVISIBLE);
    this.ownerEmailVisibility = new ObservableInt(View.VISIBLE);
    this.ownerLocationVisibility = new ObservableInt(View.VISIBLE);
    // Trigger loading the rest of the user data as soon as the view model is created.
    // It's odd having to trigger this from here. Cases where accessing to the data model
    // needs to happen because of a change in the Activity/Fragment lifecycle
    // (i.e. an activity created) don't work very well with this MVVM pattern.
    // It also makes this class more difficult to test. Hopefully a better solution will be found
    loadFullUser(repository.owner.url);
}
 
开发者ID:ivacf,项目名称:archi,代码行数:17,代码来源:RepositoryViewModel.java

示例5: BaseLibraryActivityViewModel

import android.databinding.ObservableInt; //导入依赖的package包/类
public BaseLibraryActivityViewModel(Context context, boolean fitSystemWindows) {
    super(context);

    mFitSystemWindows = fitSystemWindows;
    mExpandedHeight = getDimensionPixelSize(R.dimen.miniplayer_height);
    mAnimateSlideInOut = false;

    mMiniplayerHeight = new ObservableInt(0);
    mMiniplayerAlpha = new ObservableFloat(1.0f);
    mNowPlayingToolbarAlpha = new ObservableFloat(0.0f);

    int backgroundColor = getColor(R.color.background);
    mNowPlayingBackground = new ColorDrawable(backgroundColor);

    setPlaybackOngoing(false);
}
 
开发者ID:marverenic,项目名称:Jockey,代码行数:17,代码来源:BaseLibraryActivityViewModel.java

示例6: SignInViewModel

import android.databinding.ObservableInt; //导入依赖的package包/类
@Inject
public SignInViewModel(@SuppressWarnings("UnusedParameters") EventBus eventBus) {
    displayedChild = new ObservableInt(0);
    onNavigationItemSelectedListener = new BottomNavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            displayedChild.set(item.getItemId() == R.id.tab_signin ? 0 : 1);
            return true;
        }
    };
}
 
开发者ID:tresorit,项目名称:ZeroKit-Android-SDK,代码行数:12,代码来源:SignInViewModel.java

示例7: Listener

import android.databinding.ObservableInt; //导入依赖的package包/类
Listener(final ObservableInt observableInt, final Observer<? super Integer> observer) {
  this.observableInt = observableInt;
  this.onPropertyChangedCallback =
      new android.databinding.Observable.OnPropertyChangedCallback() {
        @Override
        public void onPropertyChanged(android.databinding.Observable observable,
            int ignoredPropertyId) {
          if (!isDisposed()) {
            ObservableInt observableInt = (ObservableInt) observable;
            observer.onNext(observableInt.get());
          }
        }
      };
}
 
开发者ID:oldergod,项目名称:RxDataBinding,代码行数:15,代码来源:ObservableIntObservable.java

示例8: FollowersInfoViewModel

import android.databinding.ObservableInt; //导入依赖的package包/类
public FollowersInfoViewModel(@NonNull DataListener dataListener, @NonNull Context context,
                              Session session, User user) {
    this.dataListener = dataListener;
    this.context = context;
    this.session = session;
    this.user = user;

    activityFollowersInfoRecyclerView = new ObservableInt(View.GONE);

    initializeViews();
    fetchTweetsList();
}
 
开发者ID:ahmed-adel-said,项目名称:Twitter_Client,代码行数:13,代码来源:FollowersInfoViewModel.java

示例9: FollowersViewModel

import android.databinding.ObservableInt; //导入依赖的package包/类
public FollowersViewModel(@NonNull DataListener dataListener, @NonNull Context context,
                          TwitterSession session, Long userId) {
    this.dataListener = dataListener;
    this.context = context;
    this.session = session;
    this.userId = userId;
    activityFollowerProgressBar = new ObservableInt(View.VISIBLE);
    activityFollowerSwipeRefreshLayout = new ObservableInt(View.GONE);
    activityFollowerRecyclerView = new ObservableInt(View.GONE);
    activityFollowerIsPullToRefresh = new ObservableBoolean(false);
    initializeViews();
    fetchFollowersList(false, false, cursor);
}
 
开发者ID:ahmed-adel-said,项目名称:Twitter_Client,代码行数:14,代码来源:FollowersViewModel.java

示例10: SSLoginViewModel

import android.databinding.ObservableInt; //导入依赖的package包/类
public SSLoginViewModel(Context context) {
    this.context = context;
    this.ssLoginLoadingVisibility = new ObservableInt(View.INVISIBLE);
    this.ssLoginControlsVisibility = new ObservableInt(View.VISIBLE);

    this.configureGoogleLogin();
    this.configureFacebookLogin();
    this.configureFirebase();
}
 
开发者ID:Adventech,项目名称:sabbath-school-android,代码行数:10,代码来源:SSLoginViewModel.java

示例11: SSQuarterliesViewModel

import android.databinding.ObservableInt; //导入依赖的package包/类
public SSQuarterliesViewModel(Context context, final DataListener dataListener, SsQuarterliesActivityBinding ssQuarterliesActivityBinding) {
    this.context = context;
    this.dataListener = dataListener;
    this.ssQuarterliesActivityBinding = ssQuarterliesActivityBinding;
    ssQuarterliesLoadingVisibility = new ObservableInt(View.INVISIBLE);
    ssQuarterliesListVisibility = new ObservableInt(View.INVISIBLE);
    ssQuarterliesLanguageFilterVisibility = new ObservableInt(View.GONE);
    ssQuarterliesErrorMessageVisibility = new ObservableInt(View.INVISIBLE);
    ssQuarterliesEmptyStateVisibility = new ObservableInt(View.INVISIBLE);
    ssQuarterliesErrorStateVisibility = new ObservableInt(View.INVISIBLE);
    ssQuarterliesListMarginTop = new ObservableFloat(0);
    ssFirebaseDatabase = FirebaseDatabase.getInstance().getReference();
    ssFirebaseDatabase.keepSynced(true);

    this.ssQuarterlyLanguages = new ArrayList<>();
    this.ssQuarterlies = new ArrayList<>();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);


    String ssLastLanguageSelected = prefs.getString(SSConstants.SS_LAST_LANGUAGE_INDEX, "");
    ssDefaultLanguage = Locale.getDefault().getLanguage();

    if (!ssLastLanguageSelected.isEmpty()){
        ssDefaultLanguage = ssLastLanguageSelected;
    }

    ssQuarterlyLanguage = new SSQuarterlyLanguage(ssDefaultLanguage, getDisplayLanguageByCode(ssDefaultLanguage), 1);

    loadLanguages();
}
 
开发者ID:Adventech,项目名称:sabbath-school-android,代码行数:32,代码来源:SSQuarterliesViewModel.java

示例12: ExplorerViewModel

import android.databinding.ObservableInt; //导入依赖的package包/类
/**
 * Default constructor.
 * @param context The context of the current activity.
 */
public ExplorerViewModel(Context context) {
    this.context = context;
    this.isLoading = new ObservableBoolean(false);
    this.isRefreshing = new ObservableBoolean(false);
    this.files = new ObservableArrayList<FileViewModel>();
    this.isSelectionMode = new ObservableBoolean(false);
    this.numberSelectedItems = new ObservableInt(0);
    this.changeDirectory("/");
}
 
开发者ID:Paul-DS,项目名称:SimpleFTP,代码行数:14,代码来源:ExplorerViewModel.java

示例13: BrowseThingViewModel

import android.databinding.ObservableInt; //导入依赖的package包/类
public BrowseThingViewModel(Context context, LoaderManager loaderManager, DataListener<T> dataListener) {
    this.context = context;
    this.loaderManager = loaderManager;
    this.dataListener = dataListener;
    infoMessageVisibility = new ObservableInt(View.VISIBLE);
    progressVisibility = new ObservableInt(View.INVISIBLE);
    recyclerViewVisibility = new ObservableInt(View.INVISIBLE);
    searchButtonVisibility = new ObservableInt(View.GONE);
    infoMessage = getInfoObservableField(context);
}
 
开发者ID:mikesol,项目名称:favorite-things,代码行数:11,代码来源:BrowseThingViewModel.java

示例14: computesArrayList

import android.databinding.ObservableInt; //导入依赖的package包/类
@Test
public void computesArrayList() throws Exception {
    final int NUMBER_1 = 23;
    final int NUMBER_2 = 56;
    final ObservableInt number = new ObservableInt(NUMBER_1);
    final ObservableArrayList<Integer> ints =
            Cinder.<Integer>computeArrayList((list)->list.add(number.get()), number).immediate();
    assertEquals(ints.get(0).longValue(), NUMBER_1);

    number.set(NUMBER_2);
    assertEquals(ints.get(1).longValue(), NUMBER_2);
}
 
开发者ID:akiraspeirs,项目名称:Cinder,代码行数:13,代码来源:CinderUnitTest.java

示例15: computesInt

import android.databinding.ObservableInt; //导入依赖的package包/类
@Test
public void computesInt() throws Exception {
    int int1 = 4321;
    int int2 = 23;
    ObservableInt obsInt = new ObservableInt(int1);
    ObservableInt computedInt = Cinder.computeInt(()->obsInt.get(), obsInt).immediate();
    assertEquals(computedInt.get(), int1);

    obsInt.set(int2);
    assertEquals(computedInt.get(), int2);
}
 
开发者ID:akiraspeirs,项目名称:Cinder,代码行数:12,代码来源:CinderUnitTest.java


注:本文中的android.databinding.ObservableInt类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。