• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ActivityEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getVoiceResponse

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
public void getVoiceResponse(String text) {
    voiceMainApi.getVoiceResponse(text)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .compose(mActivityLifecycleProvider.bindUntilEvent(ActivityEvent.DESTROY))
            .filter(stickerAdapt2Result -> {
                if (stickerAdapt2Result == null) {
                    ProgressBarHelper.getInstance(true).dismiss();
                    return false;
                }
                return true;
            })
            .subscribe(dataResponse -> {
                if (isViewBound()) {
                    mStickerAdapt2Result = dataResponse;
                    addPaintData(mStickerAdapt2Result);
                    mViewport.bindVoiceData(mStickerAdapt2Result);
                }
            }, throwable -> {
                EventBus.getDefault().post(new EventVoiceResponseError(true));
                ProgressBarHelper.getInstance(true).dismiss();
                throwable.printStackTrace();
            });
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:25,代码来源:VoicePresenter.java


示例2: onCreate

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_stop);

    textView = (TextView) findViewById(R.id.textview);
    textView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity( new Intent( StopActivity.this , OtherActivity.class));
        }
    });

    //循环发送数字
    Observable.interval(0, 1, TimeUnit.SECONDS)
            .subscribeOn( Schedulers.io())
            .compose(this.<Long>bindUntilEvent(ActivityEvent.STOP ))   //当Activity执行Onstop()方法是解除订阅关系
            .observeOn( AndroidSchedulers.mainThread())
            .subscribe(new Action1<Long>() {
                @Override
                public void call(Long aLong) {
                    System.out.println("lifecycle-stop-" + aLong);
                    textView.setText( "" + aLong );
                }
            });
}
 
开发者ID:zyj1609wz,项目名称:RxJava_RxAndroid,代码行数:27,代码来源:StopActivity.java


示例3: getBalancesPage

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
private void getBalancesPage() {
    showProgressBar();
    RetrofitManager.api().getBalance().cache()
            .retry(2)
            .compose(this.bindUntilEvent(ActivityEvent.STOP))
            .compose(applySchedulers())
            .cast(Document.class)
            .subscribe(new HandlerSubscriber() {
                @Override
                public void onException(Throwable e) {
                    super.onException(e);
                    onFailed(R.string.connection_error, new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            getBalancesPage();
                        }
                    });
                }

                @Override
                public void onDone(Document document) {
                    super.onDone(document);
                    parseAndUpdateUI(document);
                }
            });
}
 
开发者ID:y3seker,项目名称:EgeYemekhaneMobil,代码行数:27,代码来源:BalanceActivity.java


示例4: onCreate

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ButterKnife.bind(this);

    getSupportFragmentManager()
            .beginTransaction()
            .replace(R.id.frame_container, Fragment.instantiate(this, CmmFragment.class.getName()))
            .replace(R.id.frame_keyboard, Fragment.instantiate(this, KeyboardFragment.class.getName()))
            .commit();

    ViewCompat.setElevation(mToolbar, 7);

    RxBus.getInstance().toObservable()
            .compose(bindUntilEvent(ActivityEvent.DESTROY))
            .filter(events -> events.what == Events.EventEnum.WE_HIDE_ALL)
            .subscribe(events -> {
                finish();
            });

}
 
开发者ID:caifeile,项目名称:FlowGeek,代码行数:22,代码来源:CmmActivity.java


示例5: onDestroy

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
@CallSuper
@Override
protected void onDestroy() {
  this.lifecycle.onNext(ActivityEvent.DESTROY);
  super.onDestroy();
  Timber.d("onDestroy %s", this.toString());

  this.subscriptions.clear();

  if (isFinishing()) {
    if (this.viewModel != null) {
      ActivityViewModelManager.getInstance().destroy(this.viewModel);
      this.viewModel = null;
    }
  }
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:17,代码来源:BaseActivity.java


示例6: onCreate

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
@Override
public void onCreate(final @Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.video_player_layout);
  ButterKnife.bind(this);

  this.viewModel.outputs.preparePlayerWithUrl()
    .compose(Transformers.takeWhen(lifecycle().filter(ActivityEvent.RESUME::equals)))
    .compose(bindToLifecycle())
    .subscribe(this::preparePlayer);

  this.mediaController = new MediaController(this);
  this.mediaController.setAnchorView(this.rootView);

  RxView.clicks(this.rootView)
    .compose(bindToLifecycle())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(__ -> toggleControlsVisibility());
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:20,代码来源:VideoActivity.java


示例7: subscribe

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
public Observable subscribe(Observable mObservable, Observer observer) {
    mObservable.subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .compose(getActivityLifecycleProvider().bindUntilEvent(ActivityEvent.DESTROY))
            .subscribe(observer);
    return mObservable;
}
 
开发者ID:jeasinlee,项目名称:AndroidBasicLibs,代码行数:8,代码来源:BaseModel.java


示例8: onCreate

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mActivity = this;
    activityManagerUtil = ActivityManagerUtil.getInstance();
    activityManagerUtil.pushOneActivity(this);

    lifecycleSubject.onNext(ActivityEvent.CREATE);
    requestWindowFeature(Window.FEATURE_NO_TITLE);// 去掉标题栏
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    mToast = DrawerToast.getInstance(getApplicationContext());
}
 
开发者ID:jeasinlee,项目名称:AndroidBasicLibs,代码行数:14,代码来源:BaseActivity.java


示例9: showItemsMenu

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
private void showItemsMenu(final MyMenusItem item, final String menuType) {
    String date = Utils.myMenusDateFormat.format(item.date.getTime());
    String url = user.getBaseUrl() + "/yemekliste.aspx?tarih=" + date + "&ogun=" + menuType;
    RetrofitManager.api().getRequest(url)
            .compose(this.bindUntilEvent(ActivityEvent.STOP))
            .cast(Document.class)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Subscriber<Document>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    Toast.makeText(MyMenusActivity.this, R.string.error_tryagain, Toast.LENGTH_SHORT).show();
                }

                @Override
                public void onNext(Document document) {
                    String menu, title = document.select("[id=Label1]").text();
                    Element table = document.select("[id=lblTable]").first();
                    if (table.children().size() == 0)
                        menu = getString(R.string.no_menu_found);
                    else {
                        Elements menuRows = table.select("tbody").first().children();
                        menuRows.remove(0);
                        menu = title + "\n\n";
                        for (Element menuRow : menuRows) {
                            menu += menuRow.text() + "\n";
                        }
                    }
                    makeDialog(item.dateString + menuType, menu);
                }
            });
}
 
开发者ID:y3seker,项目名称:EgeYemekhaneMobil,代码行数:38,代码来源:MyMenusActivity.java


示例10: postItem

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
private void postItem(String name, final int pos) {
    hideFab();
    FormEncodingBuilder feb = ConnectionUtils.febWithViewStates(user.getViewStates());
    boolean hasCheckedItem = false;
    for (OrderItem orderItem : orderItems) {
        if (orderItem.isChecked) {
            feb.add(orderItem.name, ON);
            hasCheckedItem = true;
        }
    }
    final boolean finalHasCheckItem = hasCheckedItem;
    RequestBody formBody = feb.add(EVENT_TARGET, name)
            .add(EVENT_ARG, "").build();
    Subscription sub = RetrofitManager.api().postOrder(formBody)
            .retry(1)
            .compose(this.bindUntilEvent(ActivityEvent.STOP))
            .cast(Document.class)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Subscriber<Document>() {
                @Override
                public void onCompleted() {
                    if (finalHasCheckItem) showFab();
                }

                @Override
                public void onError(Throwable e) {
                    if (finalHasCheckItem) showFab();
                    rvAdapter.progressDone(false, pos);
                }

                @Override
                public void onNext(Document document) {
                    rvAdapter.progressDone(true, pos);
                    harcananText.setText(document.getElementById(HARCANAN_BAKIYE).text().replace("TL", " TL"));
                    kalanText.setText(document.getElementById(KALAN_BAKIYE).text().replace("TL", " TL"));
                }
            });
    subs.add(sub);
}
 
开发者ID:y3seker,项目名称:EgeYemekhaneMobil,代码行数:41,代码来源:OrderActivity.java


示例11: onCreate

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    mCatalog = getIntent().getIntExtra(TYPE_KEY, TYPE_TEXT);
    super.onCreate(savedInstanceState);
    ButterKnife.bind(this);

    getSupportFragmentManager().beginTransaction()
            .replace(R.id.frame_emotion_panel, Fragment.instantiate(this, EmotionPanelFragment.class.getName()))
            .commit();

    mDelegation = new KeyboardActionDelegation(this, mInput, mEmotionBtn, mEmotionFrame);

    switch (mCatalog){
        case TYPE_IMAGE:
            Intent intent = new Intent(Intent.ACTION_PICK);
            intent.setType("image/*");
            if (intent.resolveActivity(getPackageManager())!=null){
                startActivityForResult(Intent.createChooser(intent, "选择图片"), REQUEST_CODE_PICK_IMAGE);
            }
            break;
    }

    RxBus.with(this)
            .setEvent(Events.EventEnum.DELIVER_SELECT_EMOTION)
            .setEndEvent(ActivityEvent.DESTROY)
            .onNext((events -> {
                EmotionRules emotion = events.<EmotionRules>getMessage();
                mDelegation.onEmotionItemSelected(emotion);
            })).create();
}
 
开发者ID:caifeile,项目名称:FlowGeek,代码行数:31,代码来源:TweetPublishActivity.java


示例12: initSubscribers

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
private void initSubscribers() {
    // 接受订阅, 无论在哪里登录, 都能够接收到这个事件, 并且更新侧滑抽屉的View
    RxBus.with(this)
            .setEvent(Events.EventEnum.DELIVER_LOGIN)
            .setEndEvent(ActivityEvent.DESTROY)
            .onNext((events)->{
                initLogin();
            }).create();
}
 
开发者ID:caifeile,项目名称:FlowGeek,代码行数:10,代码来源:MainActivity.java


示例13: onCreate

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
@CallSuper
@Override
protected void onCreate(final @Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  Timber.d("onCreate %s", this.toString());

  this.lifecycle.onNext(ActivityEvent.CREATE);

  assignViewModel(savedInstanceState);

  this.viewModel.intent(getIntent());
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:13,代码来源:BaseActivity.java


示例14: onStart

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
@CallSuper
@Override
protected void onStart() {
  super.onStart();
  Timber.d("onStart %s", this.toString());
  this.lifecycle.onNext(ActivityEvent.START);

  this.back
    .compose(bindUntilEvent(ActivityEvent.STOP))
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(__ -> goBack());
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:13,代码来源:BaseActivity.java


示例15: onResume

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
@CallSuper
@Override
protected void onResume() {
  super.onResume();
  Timber.d("onResume %s", this.toString());
  this.lifecycle.onNext(ActivityEvent.RESUME);

  assignViewModel(null);
  if (this.viewModel != null) {
    this.viewModel.onResume(this);
  }
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:13,代码来源:BaseActivity.java


示例16: onPause

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
@CallSuper
@Override
protected void onPause() {
  this.lifecycle.onNext(ActivityEvent.PAUSE);
  super.onPause();
  Timber.d("onPause %s", this.toString());

  if (this.viewModel != null) {
    this.viewModel.onPause();
  }
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:12,代码来源:BaseActivity.java


示例17: onStop

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
@CallSuper
@Override
protected void onStop() {
  this.lifecycle.onNext(ActivityEvent.STOP);
  super.onStop();
  Timber.d("onStop %s", this.toString());
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:8,代码来源:BaseActivity.java


示例18: isFinished

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
/**
 * Determines from a view and lifecycle event if the view's life is over.
 */
private boolean isFinished(final @NonNull ViewType view, final @NonNull ActivityEvent event) {

  if (view instanceof BaseActivity) {
    return event == ActivityEvent.DESTROY && ((BaseActivity) view).isFinishing();
  }

  return event == ActivityEvent.DESTROY;
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:12,代码来源:ActivityViewModel.java


示例19: lifecycleEvent

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
/**
 * This method is intended to be called only from `KSAdapter` in order for it to inform the view holder
 * of its lifecycle.
 */
public void lifecycleEvent(final @NonNull ActivityEvent event) {
  this.lifecycle.onNext(event);

  if (ActivityEvent.DESTROY.equals(event)) {
    destroy();
  }
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:12,代码来源:KSViewHolder.java


示例20: onViewDetachedFromWindow

import com.trello.rxlifecycle.ActivityEvent; //导入依赖的package包/类
@Override
public void onViewDetachedFromWindow(final @NonNull KSViewHolder holder) {
  super.onViewDetachedFromWindow(holder);

  // View holders are "stopped" when they are detached from the window for recycling
  holder.lifecycleEvent(ActivityEvent.STOP);

  // View holders are "destroy" when they are detached from the window and no adapter is listening
  // to events, so ostensibly the view holder is being deallocated.
  if (!hasObservers()) {
    holder.lifecycleEvent(ActivityEvent.DESTROY);
  }
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:14,代码来源:KSAdapter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ViewUtils类代码示例发布时间:2022-05-21
下一篇:
Java MockFlowFile类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap