本文整理汇总了Java中com.trello.rxlifecycle.FragmentEvent类的典型用法代码示例。如果您正苦于以下问题:Java FragmentEvent类的具体用法?Java FragmentEvent怎么用?Java FragmentEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FragmentEvent类属于com.trello.rxlifecycle包,在下文中一共展示了FragmentEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initSubscribers
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
private void initSubscribers() {
if (mCatalog == TWEET_TYPE_SELF){
RxBus.with(this)
.setEndEvent(FragmentEvent.DESTROY)
.setEvent(Events.EventEnum.DELIVER_LOGIN)
.onNext((event) -> {
mLoginLayout.setVisibility(View.GONE);
onLoadingState(BaseListFragment.LOAD_MODE_DEFAULT);
getPresenter().requestData(BaseListFragment.LOAD_MODE_DEFAULT, 0);
}).create();
RxBus.with(this)
.setEndEvent(FragmentEvent.DESTROY)
.setEvent(Events.EventEnum.DELIVER_LOGOUT)
.onNext((event) -> {
Log.d("thanatosx", "get logout message");
mAdapter.clear();
mErrorLayout.setVisibility(View.GONE);
mSwipeRefreshLayout.setEnabled(false);
mLoginLayout.setVisibility(View.VISIBLE);
mState = STATE_USER_NOT_LOGIN;
}).create();
}
}
开发者ID:caifeile,项目名称:FlowGeek,代码行数:27,代码来源:ListTweetFragment.java
示例2: getDetailData
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
private void getDetailData(String url) {
Network.getInstance().getServiceMzitu()
.getDetialData(url.substring(url.lastIndexOf("/") + 1), System.currentTimeMillis())
.compose(this.<String>bindUntilEvent(FragmentEvent.DESTROY_VIEW))
.observeOn(Schedulers.io())
.subscribeOn(Schedulers.io())
.subscribe(new BaseSubscriber<String>() {
@Override
public void onNext(String html) {
super.onNext(html);
toParserDetailHTML(html);
}
@Override
public void onCompleted() {
super.onCompleted();
}
});
}
开发者ID:whitelaning,项目名称:WhiteRead,代码行数:20,代码来源:MzituFragment.java
示例3: toLoadFirstData
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
private void toLoadFirstData(final boolean isClear) {
Network.getInstance().getServiceMzitu()
.getIndexData(System.currentTimeMillis())
.compose(this.<String>bindUntilEvent(FragmentEvent.DESTROY_VIEW))
.observeOn(Schedulers.io())
.subscribeOn(Schedulers.io())
.subscribe(new BaseSubscriber<String>() {
@Override
public void onNext(String html) {
super.onNext(html);
toParserHTML(html, isClear);
}
@Override
public void onCompleted() {
super.onCompleted();
Message msg = Message.obtain();
msg.what = 0;
msg.obj = isClear;
mHandler.sendMessage(msg);
}
});
}
开发者ID:whitelaning,项目名称:WhiteRead,代码行数:24,代码来源:MzituFragment.java
示例4: toLoadTagFirstData
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
private void toLoadTagFirstData(final boolean isClear) {
Network.getInstance().getServiceMzitu()
.getTagData(tagString, System.currentTimeMillis())
.compose(this.<String>bindUntilEvent(FragmentEvent.DESTROY_VIEW))
.observeOn(Schedulers.io())
.subscribeOn(Schedulers.io())
.subscribe(new BaseSubscriber<String>() {
@Override
public void onNext(String html) {
super.onNext(html);
toParserHTML(html, isClear, true);
}
@Override
public void onCompleted() {
super.onCompleted();
Message msg = Message.obtain();
msg.what = 0;
msg.obj = isClear;
mHandler.sendMessage(msg);
}
});
}
开发者ID:whitelaning,项目名称:WhiteRead,代码行数:24,代码来源:MzituFragment.java
示例5: onDetach
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
/**
* Called after `onDestroy` when the fragment is no longer attached to its activity.
*/
@CallSuper
@Override
public void onDetach() {
Timber.d("onDetach %s", this.toString());
super.onDetach();
if (getActivity().isFinishing()) {
if (this.viewModel != null) {
// Order of the next two lines is important: the lifecycle should update before we
// complete the view publish subject in the view model.
this.lifecycle.onNext(FragmentEvent.DETACH);
this.viewModel.onDetach();
FragmentViewModelManager.getInstance().destroy(this.viewModel);
this.viewModel = null;
}
}
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:22,代码来源:BaseFragment.java
示例6: getVideoData
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
private void getVideoData() {
Network.getInstance().getServiceGankioAPI()
.getVideoList(5, 1)
.compose(this.<GankioHistoryModel>bindUntilEvent(FragmentEvent.DESTROY_VIEW))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.map(new Func1<GankioHistoryModel, List<GankioHistoryModel.ResultsBean>>() {
@Override
public List<GankioHistoryModel.ResultsBean> call(GankioHistoryModel gankioHistoryModel) {
return gankioHistoryModel.results;
}
})
.subscribe(new BaseSubscriber<List<GankioHistoryModel.ResultsBean>>() {
@Override
public void onNext(List<GankioHistoryModel.ResultsBean> list) {
super.onNext(list);
setHeardImage(list);
}
@Override
public void onCompleted() {
super.onCompleted();
mRecyclerView.refreshComplete();
}
});
}
开发者ID:whitelaning,项目名称:WhiteRead,代码行数:27,代码来源:GankioFragment.java
示例7: getDetailData
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
private void getDetailData(final U148HomeModel.DataBean bean) {
Network.getInstance().getServiceU148API()
.getArticleData(bean.getId())
.subscribeOn(Schedulers.io())
.compose(this.<BaseResultEntity<U148HomeModel>>bindUntilEvent(FragmentEvent.DESTROY_VIEW))
.observeOn(AndroidSchedulers.mainThread())
.map(new Func1<BaseResultEntity<U148HomeModel>, U148HomeModel>() {
@Override
public U148HomeModel call(BaseResultEntity<U148HomeModel> u148HomeModelBaseResultEntity) {
return u148HomeModelBaseResultEntity.data;
}
})
.subscribe(new BaseSubscriber<U148HomeModel>() {
@Override
public void onNext(U148HomeModel response) {
super.onNext(response);
WebViewActivity.toStartActivityForResult((Activity) mContext, 1000, String.format("http://www.u148.net/article/%s.html", response.getId()));
}
});
}
开发者ID:whitelaning,项目名称:WhiteRead,代码行数:22,代码来源:U148Fragment.java
示例8: onCreate
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 处理请求tweet对象
RxBus.getInstance().toObservable()
.compose(bindUntilEvent(FragmentEvent.DESTROY))
.filter(events -> events.what == Events.EventEnum.DELIVER_TWEET)
.subscribe(events -> {
tweet = events.getMessage();
});
RxBus.getInstance().send(Events.EventEnum.GET_TWEET, Events.EventEnum.DELIVER_TWEET);
}
开发者ID:caifeile,项目名称:FlowGeek,代码行数:16,代码来源:ListTweetCmmFragment.java
示例9: initSubscribers
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
private void initSubscribers() {
// register a listener to receive a event that mean user selected a emotion
RxBus.with(this)
.setEvent(Events.EventEnum.DELIVER_SELECT_EMOTION)
.setEndEvent(FragmentEvent.DESTROY)
.onNext((events -> {
EmotionRules emotion = events.<EmotionRules>getMessage();
mDelegatioin.onEmotionItemSelected(emotion);
})).create();
// 接受返回事件,如果显示表情面板,隐藏!如果显示软键盘,隐藏!如果显示回复某某某,隐藏!
RxBus.with(this)
.setEvent(Events.EventEnum.DELIVER_GO_BACK)
.setEndEvent(FragmentEvent.DESTROY)
.onNext((events -> {
if (mReplyCmm!=null){
mInput.setHint(getResources().getString(R.string.please_say_something));
mReplyCmm = null;
return;
}
if(!mDelegatioin.onTurnBack()) return;
RxBus.getInstance().send(Events.EventEnum.WE_HIDE_ALL, null);
})).create();
RxBus.with(this)
.setEvent(Events.EventEnum.DELIVER_REPLY_SOMEONE)
.setEndEvent(FragmentEvent.DESTROY)
.onNext((events -> {
mReplyCmm = events.getMessage();
mInput.setHint("回复 @" + mReplyCmm.getAuthor());
})).create();
RxBus.with(this)
.setEvent(Events.EventEnum.DELIVER_CLEAR_IMPUT)
.setEndEvent(FragmentEvent.DESTROY)
.onNext((events -> {
mInput.setHint(getResources().getString(R.string.please_say_something));
mInput.setText(null);
})).create();
}
开发者ID:caifeile,项目名称:FlowGeek,代码行数:41,代码来源:KeyboardFragment.java
示例10: toLoadFirstData
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
private void toLoadFirstData(final boolean isClear) {
Network.getInstance().getServiceZhihuAPI()
.getLatestData()
.compose(this.<ZhihuModel>bindUntilEvent(FragmentEvent.DESTROY_VIEW))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.map(new Func1<ZhihuModel, List<ZhihuModel.StoriesBean>>() {
@Override
public List<ZhihuModel.StoriesBean> call(ZhihuModel zhihuModel) {
return zhihuModel.stories;
}
})
.subscribe(new BaseSubscriber<List<ZhihuModel.StoriesBean>>() {
@Override
public void onNext(List<ZhihuModel.StoriesBean> list) {
super.onNext(list);
setListData(list, isClear);
}
@Override
public void onCompleted() {
super.onCompleted();
if (isClear) {
mRecyclerView.refreshComplete();
} else {
mRecyclerView.loadMoreComplete();
}
}
});
}
开发者ID:whitelaning,项目名称:WhiteRead,代码行数:31,代码来源:ZhihuFragment.java
示例11: onStart
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
@Override
public void onStart() {
super.onStart();
//将普通的Observable转换为可连接的Observable
ConnectableObservable<Object> tapEventEmitter = _rxBus.toObserverable().publish();
tapEventEmitter
.compose(this.bindToLifecycle())
.subscribe(new Action1<Object>() { //一个一旦被触发就会显示TapText的监听者
@Override
public void call(Object event) {
if (event instanceof RxBusDemoFragment.TapEvent) {
_showTapText();
}
}
});
tapEventEmitter
.compose(this.bindUntilEvent(FragmentEvent.DESTROY))
.publish(new Func1<Observable<Object>, Observable<List<Object>>>() {//一个出发后缓存一秒内的点击数并显示的监听者
@Override
public Observable<List<Object>> call(Observable<Object> stream) {
return stream.buffer(stream.debounce(1, TimeUnit.SECONDS)); //进行缓冲1秒,打包发送
}
}).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<List<Object>>() {
@Override
public void call(List<Object> taps) {
_showTapCount(taps.size());
}
});
tapEventEmitter.connect(); //可连接的Observable并不在订阅时触发,而需手动调用connect()方法
}
开发者ID:cowthan,项目名称:AyoSunny,代码行数:35,代码来源:RxBusDemo_Bottom3Fragment.java
示例12: disposeLifecycle
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
@Inject
void disposeLifecycle() {
mTestRvView.lifecycle()
.doOnSubscribe(() -> mLauncher.attachView(mTestRvView))
.filter(e -> e == FragmentEvent.DESTROY_VIEW)
.subscribe(e -> mLauncher.detachView());
}
开发者ID:joy-inc,项目名称:joy-app,代码行数:9,代码来源:MvpTestRvPresenter.java
示例13: sendRequest
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
@Override
protected void sendRequest() {
String keyword = getSearchKeyword();
ApiFactory.getGanApi().getArticles(keyword, getPageSize(), mCurrentPage).compose(this.bindUntilEvent(FragmentEvent.STOP))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(mSubscriber);
}
开发者ID:godblessyouandme,项目名称:appFirst,代码行数:10,代码来源:ArticleFragment.java
示例14: sendRequest
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
@Override
protected void sendRequest() {
ApiFactory.getWXApi().getWXHot(AppConstant.KEY_WX, getPageSize(), mCurrentPage + 1).compose(this.bindUntilEvent(FragmentEvent.STOP))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(mSubscriber);
}
开发者ID:godblessyouandme,项目名称:appFirst,代码行数:8,代码来源:WXFragment.java
示例15: onAttach
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
/**
* Called before `onCreate`, when a fragment is attached to its context.
*/
@CallSuper
@Override
public void onAttach(final @NonNull Context context) {
super.onAttach(context);
Timber.d("onAttach %s", this.toString());
this.lifecycle.onNext(FragmentEvent.ATTACH);
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:11,代码来源:BaseFragment.java
示例16: onCreate
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
@CallSuper
@Override
public void onCreate(final @Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Timber.d("onCreate %s", this.toString());
this.lifecycle.onNext(FragmentEvent.CREATE);
assignViewModel(savedInstanceState);
this.viewModel.arguments(getArguments());
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:13,代码来源:BaseFragment.java
示例17: onCreateView
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
/**
* Called when a fragment instantiates its user interface view, between `onCreate` and `onActivityCreated`.
* Can return null for non-graphical fragments.
*/
@CallSuper
@Override
public @Nullable View onCreateView(final @NonNull LayoutInflater inflater, final @Nullable ViewGroup container,
final @Nullable Bundle savedInstanceState) {
final View view = super.onCreateView(inflater, container, savedInstanceState);
Timber.d("onCreateView %s", this.toString());
this.lifecycle.onNext(FragmentEvent.CREATE_VIEW);
return view;
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:14,代码来源:BaseFragment.java
示例18: onResume
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
@CallSuper
@Override
public void onResume() {
super.onResume();
Timber.d("onResume %s", this.toString());
this.lifecycle.onNext(FragmentEvent.RESUME);
assignViewModel(null);
if (this.viewModel != null) {
this.viewModel.onResume(this);
}
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:13,代码来源:BaseFragment.java
示例19: onPause
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
@CallSuper
@Override
public void onPause() {
this.lifecycle.onNext(FragmentEvent.PAUSE);
super.onPause();
Timber.d("onPause %s", this.toString());
if (this.viewModel != null) {
this.viewModel.onPause();
}
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:12,代码来源:BaseFragment.java
示例20: onStop
import com.trello.rxlifecycle.FragmentEvent; //导入依赖的package包/类
@CallSuper
@Override
public void onStop() {
this.lifecycle.onNext(FragmentEvent.STOP);
super.onStop();
Timber.d("onStop %s", this.toString());
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:8,代码来源:BaseFragment.java
注:本文中的com.trello.rxlifecycle.FragmentEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论