- mProfileListAdapter.addEditingProfilesObserver((o, arg) -> {
- if (mProfileListAdapter.isEditingProfiles()) {
- profileListHeadArrow.clearAnimation();
- profileListHeadArrow.setVisibility(View.GONE);
- profileListHeadMore.setVisibility(View.GONE);
- profileListHeadCancel.setVisibility(View.VISIBLE);
- }
- else {
- profileListHeadArrow.setRotation(180f);
- profileListHeadArrow.setVisibility(View.VISIBLE);
- profileListHeadCancel.setVisibility(View.GONE);
- profileListHeadMore.setVisibility(View.GONE);
- profileListHeadMore.setVisibility(profileListExpanded ? View.VISIBLE : View.GONE);
- }
- });
+ if (editingProfilesObserver == null) {
+ editingProfilesObserver = (o, arg) -> {
+ if (mProfileListAdapter.isEditingProfiles()) {
+ profileListHeadArrow.clearAnimation();
+ profileListHeadArrow.setVisibility(View.GONE);
+ 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));
+ }
+ else {
+ profileListHeadArrow.setRotation(180f);
+ profileListHeadArrow.setVisibility(View.VISIBLE);
+ profileListHeadCancel.setVisibility(View.GONE);
+ profileListHeadCancel
+ .startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_out));
+ profileListHeadMore.setVisibility(View.GONE);
+ if (profileListExpanded) {
+ profileListHeadMore.setVisibility(View.VISIBLE);
+ profileListHeadMore
+ .startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in));
+ }
+ else profileListHeadMore.setVisibility(View.GONE);
+ }
+ };
+ mProfileListAdapter.addEditingProfilesObserver(editingProfilesObserver);
+ }