本文整理汇总了Java中android.databinding.ObservableInt.set方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableInt.set方法的具体用法?Java ObservableInt.set怎么用?Java ObservableInt.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.databinding.ObservableInt
的用法示例。
在下文中一共展示了ObservableInt.set方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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;
}
};
}
示例4: 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);
}
示例5: 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);
}
示例6: observesObservables
import android.databinding.ObservableInt; //导入方法依赖的package包/类
@Test
public void observesObservables() throws Exception {
int int1 = 4321;
int int2 = 23;
ObservableInt observedInt = new ObservableInt();
ObservableInt observingInt = new ObservableInt();
Cinder.observe(()->observingInt.set(observedInt.get()), observedInt);
observedInt.set(int1);
assertEquals(observingInt.get(), int1);
observedInt.set(int2);
assertEquals(observingInt.get(), int2);
}
示例7: onceTakesOnce
import android.databinding.ObservableInt; //导入方法依赖的package包/类
@Test
public void onceTakesOnce() throws Exception {
int int1 = 123;
int int2 = 43;
ObservableInt observed = new ObservableInt(int1);
ObservableInt observing = Cinder.computeInt(()->
observed.get(), observed).once().immediate();
assertTrue(observing.get() == int1);
observed.set(int2);
assertTrue(observing.get() == int1);
}
示例8: filterFilters
import android.databinding.ObservableInt; //导入方法依赖的package包/类
@Test
public void filterFilters() throws Exception {
int int1 = 123;
int int2 = 32;
ObservableInt observed = new ObservableInt();
ObservableInt observing = Cinder.computeInt(()->
observed.get()
, observed).filter(()->observed.get() == int1);
observed.set(int2);
assertTrue(observing.get() == 0);
observed.set(int1);
assertTrue(observing.get() == int1);
}
示例9: takeWhileTakesWhileTrue
import android.databinding.ObservableInt; //导入方法依赖的package包/类
@Test
public void takeWhileTakesWhileTrue() throws Exception {
int int1 = 123;
int int2 = 32;
ObservableInt observed = new ObservableInt();
ObservableInt observing = Cinder.computeInt(()->
observed.get()
, observed).takeWhile(()->observed.get() == int1);
observed.set(int1);
assertTrue(observing.get() == int1);
observed.set(int2);
assertTrue(observing.get() == int1);
}
示例10: skipWhileSkipsWhileTrue
import android.databinding.ObservableInt; //导入方法依赖的package包/类
@Test
public void skipWhileSkipsWhileTrue() throws Exception {
int int1 = 123;
int int2 = 32;
ObservableInt observed = new ObservableInt();
ObservableInt observing = Cinder.computeInt(()->
observed.get()
, observed).skipWhile(()->observed.get() == int1);
observed.set(int1);
assertTrue(observing.get() == 0);
observed.set(int2);
assertTrue(observing.get() == int2);
}
示例11: stopStops
import android.databinding.ObservableInt; //导入方法依赖的package包/类
@Test
public void stopStops() throws Exception {
int int1 = 123;
int int2 = 43;
ObservableInt observed = new ObservableInt(int1);
CinderInt observing = Cinder.computeInt(()->
observed.get(), observed).immediate();
assertTrue(observing.get() == int1);
observing.stop();
observed.set(int2);
assertTrue(observing.get() == int1);
}
示例12: convertsObservableIntToRx
import android.databinding.ObservableInt; //导入方法依赖的package包/类
@Test
public void convertsObservableIntToRx() throws Exception {
ObservableInt observableInt = new ObservableInt();
Observable<Integer> rxInt = RxCinder.convert(observableInt);
final String TEST_KEY = "TEST_KEY";
final ArrayMap<String, Integer> testMap = new ArrayMap<>();
rxInt.subscribe((c)->{
testMap.put(TEST_KEY, c);});
final int TEST_INT = 23;
observableInt.set(TEST_INT);
assertTrue(testMap.get(TEST_KEY).equals(TEST_INT));
}
示例13: defaultColors
import android.databinding.ObservableInt; //导入方法依赖的package包/类
private static void defaultColors(Context context, ObservableInt title, ObservableInt artist,
ObservableInt background) {
Resources res = context.getResources();
Resources.Theme theme = context.getTheme();
title.set(ResourcesCompat.getColor(res, R.color.grid_text, theme));
artist.set(ResourcesCompat.getColor(res, R.color.grid_detail_text, theme));
background.set(ResourcesCompat.getColor(res, R.color.grid_background_default, theme));
}
示例14: checkMandatory
import android.databinding.ObservableInt; //导入方法依赖的package包/类
private boolean checkMandatory(ObservableString bindableString, ObservableInt error) {
boolean empty = bindableString.isEmpty();
error.set(empty ? R.string.mandatory_field : 0);
return !empty;
}