- if (editingProfilesObserver == null) {
- editingProfilesObserver = (o, arg) -> {
- if (mProfileListAdapter.isEditingProfiles()) {
- profileListHeadMore.setVisibility(View.GONE);
- profileListHeadMore
- .startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_out));
- profileListHeadCancel.setVisibility(View.VISIBLE);
- profileListHeadCancel
- .startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in));
- profileListHeadAddProfile.setVisibility(View.VISIBLE);
- profileListHeadAddProfile
- .startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in));
+ mProfileListAdapter.editingProfiles.observe(this, newValue -> {
+ if (newValue) {
+ profileListHeadMore.setVisibility(View.GONE);
+ profileListHeadCancel.setVisibility(View.VISIBLE);
+ profileListHeadAddProfile.setVisibility(View.VISIBLE);
+ if (drawer.isDrawerOpen(GravityCompat.START)) {
+ profileListHeadMore.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_out));
+ profileListHeadCancel.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_in));
+ profileListHeadAddProfile.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_in));