lineage-sdk self-removing prefs: move reap from onBindViewHolder to onAttached

*) Eliminates visibility of the pref removal. You could previously
   see vertical movement of text during initial display of replaced
   prefs.

*) In addition, when reaping, use setVisible(false) instead of
   removePreference.  Otherwise, array out of bounds index exceptions
   occur in frameworks pref support libraries (as a result of moving
   from onBindViewHolder to onAttached).

Change-Id: I1a0045552572a590f89715f8d94156eddaaec469
This commit is contained in:
Sam Mortimer
2017-10-14 18:54:14 -07:00
committed by Bruno Martins
parent 3c54d58691
commit 027b615325
5 changed files with 29 additions and 11 deletions

View File

@@ -43,6 +43,12 @@ public class SelfRemovingListPreference extends ListPreference {
mConstraints = new ConstraintsHelper(context, null, this);
}
@Override
public void onAttached() {
super.onAttached();
mConstraints.onAttached();
}
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);