本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
};
}
示例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());
}
}
};
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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("/");
}
示例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);
}
示例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);
}
示例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);
}