本文整理汇总了Java中com.trello.rxlifecycle.android.RxLifecycleAndroid类的典型用法代码示例。如果您正苦于以下问题:Java RxLifecycleAndroid类的具体用法?Java RxLifecycleAndroid怎么用?Java RxLifecycleAndroid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RxLifecycleAndroid类属于com.trello.rxlifecycle.android包,在下文中一共展示了RxLifecycleAndroid类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
AndroidInjection.inject(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
ButterKnife.bind(this);
setSupportActionBar(mToolbar);
getDelegate().getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mToolbar.setNavigationOnClickListener(v -> onBackPressed());
getSupportFragmentManager().beginTransaction()
.replace(R.id.container_fragment_settings, new SettingsFragment())
.commit();
mNightModePreference.asObservable()
.skip(1)
.compose(RxLifecycleAndroid.bindActivity(lifecycle()))
.subscribe(mode -> recreate());
}
开发者ID:drymarev,项目名称:rxbsuir,代码行数:20,代码来源:SettingsActivity.java
示例2: onStart
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@Override
protected void onStart() {
super.onStart();
// schedule a sync operation every minute
Observable.interval(0, 1, TimeUnit.MINUTES, mainThread())
.compose(RxLifecycleAndroid.bindActivity(lifecycle()))
.subscribe(event -> SyncBroadcastReceiver.syncNow(MainActivity.this));
}
开发者ID:M4lik,项目名称:burning-series,代码行数:10,代码来源:MainActivity.java
示例3: onAttachedToRecyclerView
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
/**
* Attaches source {@link Observable} subscription lifecycle.<p>
* Should be called from {@link Adapter#onAttachedToRecyclerView(RecyclerView)}
*
* @param recyclerView to bind source {@link Observable} to
*/
public final void onAttachedToRecyclerView(RecyclerView recyclerView) {
if (subscription != null) unsubscribe();
subscription = bindObservable()
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleAndroid.<O>bindView(recyclerView))
.subscribe(subscriber());
}
开发者ID:techery,项目名称:RxListAdapter,代码行数:14,代码来源:RxAdapterBridge.java
示例4: getPhotos
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
public void getPhotos() {
Timber.d("Starting loading local photos...");
checkViewAttached();
RxUtils.unsubscribe(mLoadPhotosSubscription);
mLoadPhotosSubscription = mDataManager.getPhotos()
.compose(RxLifecycleAndroid.bindActivity(getMvpView().getLifecycle()))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
this::showPhotos,
this::showError
);
}
开发者ID:AnironGlass,项目名称:MVP-Boilerplate,代码行数:13,代码来源:MainPresenter.java
示例5: syncPhotos
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
public void syncPhotos() {
Timber.d("Starting loading remote photos...");
checkViewAttached();
if (checkNetwork()) {
RxUtils.unsubscribe(mLoadPhotosSubscription);
mLoadPhotosSubscription = mDataManager.syncPhotos()
.compose(RxLifecycleAndroid.bindActivity(getMvpView().getLifecycle()))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
this::showPhotos,
this::showError
);
}
}
开发者ID:AnironGlass,项目名称:MVP-Boilerplate,代码行数:16,代码来源:MainPresenter.java
示例6: bindToLifecycle
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@NonNull
public final <T> LifecycleTransformer<T> bindToLifecycle() {
if (view != null) {
return RxLifecycleAndroid.bindView(view);
}
throw new IllegalStateException("No view attached");
}
开发者ID:kobakei,项目名称:Anago,代码行数:8,代码来源:CustomViewViewModel.java
示例7: bindActivity
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@NonNull
@CheckResult
public static <T> LifecycleTransformer2x<T> bindActivity(
@NonNull final Observable<ActivityEvent> lifecycle,
@NonNull final BackpressureStrategy strategy) {
LifecycleTransformer<T> rxTransformer =
RxLifecycleAndroid.bindActivity(RxJavaInterop.toV1Observable(lifecycle, strategy));
return new LifecycleTransformer2xBehaviour<>(rxTransformer, rxTransformer.forSingle(),
strategy);
}
开发者ID:VictorAlbertos,项目名称:RxLifecycleInterop,代码行数:11,代码来源:Rx2LifecycleAndroid.java
示例8: bindFragment
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@NonNull
@CheckResult
public static <T> LifecycleTransformer2x<T> bindFragment(
@NonNull final Observable<FragmentEvent> lifecycle,
@NonNull final BackpressureStrategy strategy) {
LifecycleTransformer<T> rxTransformer =
RxLifecycleAndroid.bindFragment(RxJavaInterop.toV1Observable(lifecycle, strategy));
return new LifecycleTransformer2xBehaviour<>(rxTransformer, rxTransformer.forSingle(),
strategy);
}
开发者ID:VictorAlbertos,项目名称:RxLifecycleInterop,代码行数:11,代码来源:Rx2LifecycleAndroid.java
示例9: onCreate
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
AndroidInjection.inject(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_appwidget_config);
ButterKnife.bind(this);
setupToolbar();
Intent intent = getIntent();
Bundle extras = intent.getExtras();
if (extras != null) {
mAppWidgetId =
extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
}
mResultIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
setResult(mResult, mResultIntent);
if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
finish();
}
getSupportFragmentManager().beginTransaction()
.replace(R.id.container_fragment_settings,
AppWidgetConfigFragment.newInstance(mAppWidgetId))
.commit();
mNightModePreference.asObservable()
.skip(1)
.compose(RxLifecycleAndroid.bindActivity(lifecycle()))
.subscribe(mode -> recreate());
}
开发者ID:drymarev,项目名称:rxbsuir,代码行数:34,代码来源:AppWidgetConfigActivity.java
示例10: onCreate
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getLayoutRes());
ButterKnife.bind(this);
if (!mIsFamEnabled) {
mFloatingActionMenu.setVisibility(View.GONE);
}
mFloatingActionMenu.getBackground().setAlpha(0);
addStorageFragment();
setupNavigationView();
mDrawerPresenter.attachView(this);
mDrawerPresenter.onCreate();
mSchedulePresenter.attachView(this);
if (savedInstanceState == null) {
mSchedulePresenter.setSyncId(mSyncIdPreference.get(), mIsGroupSchedulePreference.get());
RateAppDialog.newInstance(this).show();
} else {
showContent();
}
mLocalBroadcastManager = LocalBroadcastManager.getInstance(this);
initializeAnimations();
mNightModePreference.asObservable()
.skip(1)
.compose(RxLifecycleAndroid.bindActivity(lifecycle()))
.subscribe(mode -> recreate());
}
开发者ID:drymarev,项目名称:rxbsuir,代码行数:37,代码来源:ScheduleActivity.java
示例11: onCreate
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
AndroidInjection.inject(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lesson);
ButterKnife.bind(this);
setupToolbar();
Lesson lesson = Parcels.unwrap(getIntent().getParcelableExtra(EXTRA_LESSON));
getDelegate().getSupportActionBar().setTitle(lesson.getSubjectWithSubgroup());
getDelegate().getSupportActionBar().setSubtitle(lesson.getLessonType());
mAdapter = new DetailItemAdapter(this, new ArrayList<>());
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.addItemDecoration(new DetailItemDecoration(this));
mPresenter.attachView(this);
mPresenter.setLesson(lesson);
mNightModePreference.asObservable()
.skip(1)
.compose(RxLifecycleAndroid.bindActivity(lifecycle()))
.subscribe(mode -> recreate());
}
开发者ID:drymarev,项目名称:rxbsuir,代码行数:28,代码来源:LessonActivity.java
示例12: onCreate
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(theme().translucentStatus);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Bitmap icon = BitmapFactory.decodeResource(getApplicationContext().getResources(),
R.drawable.ic_stat_name);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setTaskDescription(
new ActivityManager.TaskDescription(
"Burning Series",
icon,
getApplicationContext().getResources().getColor(theme().primaryColor)
));
}
setSupportActionBar(toolbar);
if (getApplicationContext().getResources().getBoolean(R.bool.isTablet))
isTablet = true;
Settings settings = Settings.of(this);
userName = settings.getUserName();
userSession = settings.getUserSession();
navigationView.setNavigationItemSelectedListener(this);
if (!isTablet) {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
toggle.syncState();
}
//Update check
Observable.just(null)
.delay(10, TimeUnit.SECONDS, mainThread())
.compose(RxLifecycleAndroid.bindActivity(lifecycle()))
.subscribe(o -> UpdateDialog.checkForUpdates(MainActivity.this, false));
TextView userTextView = (TextView) navigationView.getHeaderView(0).findViewById(R.id.nav_username_text);
userTextView.setText(userName);
if (userSession.equals("")) {
Crashlytics.setUserIdentifier(userName);
navigationView.getMenu().findItem(R.id.login_menu_item).setVisible(true);
navigationView.getMenu().findItem(R.id.logout_menu_item).setVisible(false);
} else {
navigationView.getMenu().findItem(R.id.login_menu_item).setVisible(false);
navigationView.getMenu().findItem(R.id.logout_menu_item).setVisible(true);
}
}
开发者ID:M4lik,项目名称:burning-series,代码行数:55,代码来源:MainActivity.java
示例13: bindToLifecycle
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
return RxLifecycleAndroid.bindActivity(lifecycleSubject);
}
开发者ID:jiang111,项目名称:ZhiHu-TopAnswer,代码行数:7,代码来源:RxFragmentActivity.java
示例14: bindToLifecycle
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
return RxLifecycleAndroid.bindFragment(lifecycleSubject);
}
开发者ID:jiang111,项目名称:ZhiHu-TopAnswer,代码行数:7,代码来源:RxFragment.java
示例15: bindToLifecycle
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
return RxLifecycleAndroid.bindFragment(fragmentLifecycleEvent);
}
开发者ID:nhpatt,项目名称:Catalogo-de-Actividades-ASDE,代码行数:7,代码来源:FragmentPresenterImpl.java
示例16: bindToLifecycle
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
return RxLifecycleAndroid.bindActivity(activityLifecycleEvent);
}
开发者ID:nhpatt,项目名称:Catalogo-de-Actividades-ASDE,代码行数:7,代码来源:ActivityPresenterImpl.java
示例17: bindToLifecycle
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
return RxLifecycleAndroid.bindFragment(lifecycle);
}
开发者ID:raatiniemi,项目名称:worker,代码行数:7,代码来源:RxDialogFragment.java
示例18: bindToLifecycle
import com.trello.rxlifecycle.android.RxLifecycleAndroid; //导入依赖的package包/类
/**
* Completes an observable when the lifecycle event opposing the current lifecyle event is emitted.
* For example, if a subscription is made during {@link ActivityEvent#CREATE}, the observable will be completed
* in {@link ActivityEvent#DESTROY}.
*/
public <T> Observable.Transformer<T, T> bindToLifecycle() {
return RxLifecycleAndroid.bindActivity(lifecycle);
}
开发者ID:fobid,项目名称:rxbase-android,代码行数:9,代码来源:TfcBaseActivity.java
注:本文中的com.trello.rxlifecycle.android.RxLifecycleAndroid类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论