本文整理汇总了Java中rx.functions.Action3类的典型用法代码示例。如果您正苦于以下问题:Java Action3类的具体用法?Java Action3怎么用?Java Action3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Action3类属于rx.functions包,在下文中一共展示了Action3类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initArticles
import rx.functions.Action3; //导入依赖的package包/类
private void initArticles(List<ZhihuStoryItem> items) {
for (ZhihuStoryItem item : items)
getAdapter().add(new ZhihuStoryItemViewModel(item)
.onAction(new Action3<String, Integer, Integer>() {
@Override
public void call(String id, Integer touchX, Integer touchY) {
Intent intent = ZhihuStoryDetailActivity.intentFor(getContext());
intent.putExtra(Constant.EXTRA_ZHIHU_STORY_ID, id);
intent.putExtra(Constant.EXTRA_TOUCH_X, touchX);
intent.putExtra(Constant.EXTRA_TOUCH_Y, touchY);
getContext().startActivity(intent);
}
}));
getAdapter().add(new BlankViewModel(R.dimen.common_gap));
getAdapter().notifyDataSetChanged();
}
开发者ID:Mindjet,项目名称:LiteReader,代码行数:18,代码来源:ZhihuSectionDetailViewModel.java
示例2: combine
import rx.functions.Action3; //导入依赖的package包/类
/**
* Combines provided actions into a single action stream
*
* @param a1 Action
* @param a2 Action
* @param a3 Action
* @param a4 Action
* @param a5 Action
* @param a6 Action
* @return Single action stream combined from provided actions
*/
@CheckResult
@NonNull
public static <T1, T2, T3> Action3<? super T1, ? super T2, ? super T3> combine(@NonNull final Action3<? super T1, ? super T2, ? super T3> a1, @NonNull final Action3<? super T1, ? super T2, ? super T3> a2, @NonNull final Action3<? super T1, ? super T2, ? super T3> a3, @NonNull final Action3<? super T1, ? super T2, ? super T3> a4, @NonNull final Action3<? super T1, ? super T2, ? super T3> a5, @NonNull final Action3<? super T1, ? super T2, ? super T3> a6) {
return new Action3<T1, T2, T3>() {
@Override
public void call(T1 t1, T2 t2, T3 t3) {
a1.call(t1, t2, t3);
a2.call(t1, t2, t3);
a3.call(t1, t2, t3);
a4.call(t1, t2, t3);
a5.call(t1, t2, t3);
a6.call(t1, t2, t3);
}
};
}
开发者ID:VolodymyrLykhonis,项目名称:RxActions,代码行数:27,代码来源:Actions.java
示例3: createSingleState
import rx.functions.Action3; //导入依赖的package包/类
@Experimental
public static <S, T> Observable$OnSubscribe<T> createSingleState(Func0<? extends S> generator, final Action3<? super S, Long, ? super Observer<Observable<? extends T>>> next) {
return new AsyncOnSubscribeImpl((Func0) generator, new Func3<S, Long, Observer<Observable<? extends T>>, S>() {
public S call(S state, Long requested, Observer<Observable<? extends T>> subscriber) {
next.call(state, requested, subscriber);
return state;
}
});
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:AsyncOnSubscribe.java
示例4: onBindViewHolder
import rx.functions.Action3; //导入依赖的package包/类
public void onBindViewHolder(VH viewHolder, int position, T item) { // final, DO NOT Override until certainly
onBindViewHolderSupered = true;
if (mOnBindViewHolder == null) {
mOnBindViewHolder = new Action3<VH, Integer, T>() {
@Override
public void call(VH vh, Integer i, T t) {
vh.onBind(i, t);
}
};
}
mOnBindViewHolder.call(viewHolder, position, item);
}
开发者ID:yongjhih,项目名称:RxParse,代码行数:13,代码来源:ListRecyclerAdapter.java
示例5: MovieCollectItemViewModel
import rx.functions.Action3; //导入依赖的package包/类
public MovieCollectItemViewModel(DoubanMovieItem item, Action1<DoubanMovieItem> onClick, Action3<String, String, Integer> onUncollect) {
this.item = item;
this.onClick = onClick;
this.onUncollect = onUncollect;
}
开发者ID:Mindjet,项目名称:LiteReader,代码行数:6,代码来源:MovieCollectItemViewModel.java
示例6: OneCommonCollectItemViewModel
import rx.functions.Action3; //导入依赖的package包/类
public OneCommonCollectItemViewModel(String id, String imgUrl, String title, Action3<String, String, Integer> onUnCollect) {
this.id = id;
this.imgUrl = imgUrl;
this.title = title;
this.onUnCollect = onUnCollect;
}
开发者ID:Mindjet,项目名称:LiteReader,代码行数:7,代码来源:OneCommonCollectItemViewModel.java
示例7: StoryCollectItemViewModel
import rx.functions.Action3; //导入依赖的package包/类
public StoryCollectItemViewModel(ZhihuStoryItem item, Action1<ZhihuStoryItem> onClick, Action3<String, String, Integer> onUncollect) {
this.item = item;
this.onClick = onClick;
this.onUncollect = onUncollect;
}
开发者ID:Mindjet,项目名称:LiteReader,代码行数:6,代码来源:StoryCollectItemViewModel.java
示例8: initActions
import rx.functions.Action3; //导入依赖的package包/类
private void initActions() {
onMovieItemClick = new Action1<DoubanMovieItem>() {
@Override
public void call(DoubanMovieItem item) {
Intent intent = DoubanMovieDetailActivity.intentFor(getContext());
intent.putExtra(Constant.EXTRA_DOUBAN_MOVIE_ID, item.id);
intent.putExtra(Constant.EXTRA_DOUBAN_MOVIE_POSTER, item.images.large);
intent.putExtra(Constant.EXTRA_DOUBAN_MOVIE_TITLE, item.title);
intent.putExtra(Constant.EXTRA_DOUBAN_MOVIE_MAINLAND_PUBDATE, item.mainlandPubdate);
intent.putExtra(Constant.EXTRA_DOUBAN_MOVIE_RATING, item.rating.average + "/" + 10);
getContext().startActivity(intent);
}
};
onStoryItemClick = new Action1<ZhihuStoryItem>() {
@Override
public void call(ZhihuStoryItem zhihuStoryItem) {
Intent intent = ZhihuStoryDetailActivity.intentFor(getContext());
intent.putExtra(Constant.EXTRA_ZHIHU_STORY_ID, zhihuStoryItem.id);
getContext().startActivity(intent);
}
};
onUnCollect = new Action3<String, String, Integer>() {
@Override
public void call(final String id, final String type, final Integer position) {
RxTask.asyncTask(new Action0() {
@Override
public void call() {
CollectionManager.getInstance(getContext()).remove(id, type);
}
}, new Action0() {
@Override
public void call() {
getAdapter().remove(position.intValue());
getAdapter().notifyItemRemoved(position);
boolean sectionEmpty = false;
switch (type) {
case CollectionManager.COLLECTION_TYPE_DOUBAN_MOVIE:
movieSize -= 1;
sectionEmpty = movieSize == 0;
break;
case CollectionManager.COLLECTION_TYPE_ZHIHU_STORY:
storySize -= 1;
sectionEmpty = storySize == 0;
break;
case CollectionManager.COLLECTION_TYPE_ONE_REVIEW:
oneReviewSize -= 1;
sectionEmpty = oneReviewSize == 0;
break;
case CollectionManager.COLLECTION_TYPE_ONE_ARTICLE:
oneArticleSize -= 1;
sectionEmpty = oneArticleSize == 0;
break;
}
if (sectionEmpty) {
getAdapter().remove(position - 1);
getAdapter().notifyItemRemoved(position - 1);
}
}
});
}
};
}
开发者ID:Mindjet,项目名称:LiteReader,代码行数:64,代码来源:CollectViewModel.java
示例9: initActions
import rx.functions.Action3; //导入依赖的package包/类
private void initActions() {
onLoadLatestNews = new Action1<ZhihuDailyList>() {
@Override
public void call(ZhihuDailyList list) {
initBanner(list.topStories);
getAdapter().add(new ZhihuDateItemViewModel(R.string.special_section));
getAdapter().add(section);
getAdapter().add(new ZhihuDateItemViewModel(R.string.latest_daily));
initNews(list.stories);
hideRefreshing();
loadSections();
setIsLoadingMore(false);
enableLoadMore();
}
};
onRefreshLatestNews = new Action1<ZhihuDailyList>() {
@Override
public void call(ZhihuDailyList list) {
getAdapter().clear();
getAdapter().add(banner);
getAdapter().add(new ZhihuDateItemViewModel(R.string.special_section));
getAdapter().add(section);
updateBanner(list.topStories);
getAdapter().add(new ZhihuDateItemViewModel(R.string.latest_daily));
initNews(list.stories);
hideRefreshing();
loadSections();
setIsLoadingMore(false);
enableLoadMore();
date = new Date(); //重置日期
}
};
onDailyItemClick = new Action3<String, Integer, Integer>() {
@Override
public void call(String id, Integer touchX, Integer touchY) {
Intent intent = ZhihuStoryDetailActivity.intentFor(getContext());
intent.putExtra(Constant.EXTRA_ZHIHU_STORY_ID, id);
intent.putExtra(Constant.EXTRA_TOUCH_X, touchX);
intent.putExtra(Constant.EXTRA_TOUCH_Y, touchY);
getContext().startActivity(intent);
}
};
onSectionItemClick = new Action2<String, String>() {
@Override
public void call(String id, String name) {
Intent intent = ZhihuSectionDetailActivity.intentFor(getContext());
intent.putExtra(Constant.EXTRA_ZHIHU_SECTION_ID, id);
intent.putExtra(Constant.EXTRA_ZHIHU_SECTION_NAME, name);
getContext().startActivity(intent);
}
};
}
开发者ID:Mindjet,项目名称:LiteReader,代码行数:53,代码来源:ZhihuDailyListViewModel.java
示例10: bindViewHolder
import rx.functions.Action3; //导入依赖的package包/类
public ListRecyclerAdapter<T, VH> bindViewHolder(Action3<VH, Integer, T> onBindViewHolder) {
mOnBindViewHolder = onBindViewHolder;
return this;
}
开发者ID:yongjhih,项目名称:RxParse,代码行数:5,代码来源:ListRecyclerAdapter.java
示例11: doNothing3
import rx.functions.Action3; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T, R, S> Action3<T, R, S> doNothing3() {
return (Action3<T, R, S>) HolderDoNothing3.INSTANCE;
}
开发者ID:davidmoten,项目名称:rxjava-extras,代码行数:5,代码来源:Actions.java
示例12: setRecordCounterListener
import rx.functions.Action3; //导入依赖的package包/类
public void setRecordCounterListener(Action3 action) {
this.recordCounterListener = action;
}
开发者ID:Netflix,项目名称:suro,代码行数:4,代码来源:KafkaSink.java
示例13: testCheckPause
import rx.functions.Action3; //导入依赖的package包/类
@Test
public void testCheckPause() throws IOException, InterruptedException {
TopicCommand.createTopic(zk.getZkClient(),
new TopicCommand.TopicCommandOptions(new String[]{
"--zookeeper", "dummy", "--create", "--topic", TOPIC_NAME + "check_pause",
"--replication-factor", "2", "--partitions", "1"}));
String description = "{\n" +
" \"type\": \"kafka\",\n" +
" \"client.id\": \"kafkasink\",\n" +
" \"bootstrap.servers\": \"" + kafkaServer.getBrokerListStr() + "\",\n" +
" \"acks\": 1,\n" +
" \"buffer.memory\": 1000,\n" +
" \"batch.size\": 1000\n" +
"}";
final KafkaSink sink = jsonMapper.readValue(description, new TypeReference<Sink>(){});
sink.open();
final AtomicBoolean exceptionCaught = new AtomicBoolean(false);
final AtomicBoolean checkPaused = new AtomicBoolean(false);
final AtomicBoolean pending = new AtomicBoolean(false);
final CountDownLatch latch = new CountDownLatch(1);
sink.setRecordCounterListener(new Action3<Long, Long, Long>() {
@Override
public void call(Long queued, Long sent, Long dropped) {
if (dropped > 0) {
exceptionCaught.set(true);
if (sink.checkPause() > 0) {
checkPaused.set(true);
}
if (sink.getNumOfPendingMessages() > 0) {
pending.set(true);
}
latch.countDown();
}
}
});
for (int i = 0; i < 100; ++i) {
sink.writeTo(new DefaultMessageContainer(new Message(TOPIC_NAME + "check_pause", getBigData()), jsonMapper));
}
assertTrue(latch.await(10, TimeUnit.SECONDS));
assertTrue(exceptionCaught.get());
assertTrue(checkPaused.get());
assertTrue(pending.get());
}
开发者ID:Netflix,项目名称:suro,代码行数:49,代码来源:TestKafkaSink.java
示例14: testStartWithKafkaOutage
import rx.functions.Action3; //导入依赖的package包/类
@Test
public void testStartWithKafkaOutage() throws Throwable {
String topicName = TOPIC_NAME + "kafkaoutage";
TopicCommand.createTopic(zk.getZkClient(),
new TopicCommand.TopicCommandOptions(new String[]{
"--zookeeper", "dummy", "--create", "--topic", topicName,
"--replication-factor", "2", "--partitions", "1"}));
String[] brokerList = kafkaServer.getBrokerListStr().split(",");
int port1 = Integer.parseInt(brokerList[0].split(":")[1]);
int port2 = Integer.parseInt(brokerList[1].split(":")[1]);
String description = "{\n" +
" \"type\": \"kafka\",\n" +
" \"client.id\": \"kafkasink\",\n" +
" \"bootstrap.servers\": \"" + kafkaServer.getBrokerListStr() + "\",\n" +
" \"acks\": 1\n" +
" }" +
"}";
kafkaServer.shutdown();
final KafkaSink sink = jsonMapper.readValue(description, new TypeReference<Sink>(){});
sink.open();
final int msgCount = 10000;
final CountDownLatch latch = new CountDownLatch(1);
sink.setRecordCounterListener(new Action3<Long, Long, Long>() {
@Override
public void call(Long queued, Long sent, Long dropped) {
if (sent == msgCount - sink.droppedRecords.get()) {
latch.countDown();
}
}
});
sendMessages(topicName, sink, msgCount);
kafkaServer.startServer(port1, port2); // running up
assertTrue(latch.await(10, TimeUnit.SECONDS));
sendMessages(topicName, sink, msgCount);
sink.close();
checkConsumer(topicName, 2 * msgCount - (int) sink.droppedRecords.get());
}
开发者ID:Netflix,项目名称:suro,代码行数:50,代码来源:TestKafkaSink.java
注:本文中的rx.functions.Action3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论