mirror of
https://github.com/accelforce/Yuito
synced 2024-12-24 23:01:41 +01:00
Fix TalkBack not initializing old views in recycler (#2036)
This commit is contained in:
parent
9898abe07a
commit
c178804efe
@ -24,11 +24,13 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.arch.core.util.Function;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.util.Pair;
|
||||
import androidx.core.widget.ContentLoadingProgressBar;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
@ -95,6 +97,7 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -1471,9 +1474,21 @@ public class TimelineFragment extends SFragment implements
|
||||
}
|
||||
};
|
||||
|
||||
AccessibilityManager a11yManager;
|
||||
boolean talkBackWasEnabled;
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
a11yManager = Objects.requireNonNull(
|
||||
ContextCompat.getSystemService(requireContext(), AccessibilityManager.class)
|
||||
);
|
||||
boolean wasEnabled = this.talkBackWasEnabled;
|
||||
talkBackWasEnabled = a11yManager.isEnabled();
|
||||
Log.d(TAG, "talkback was enabled: " + wasEnabled + ", now " + talkBackWasEnabled);
|
||||
if (talkBackWasEnabled && !wasEnabled) {
|
||||
this.adapter.notifyDataSetChanged();
|
||||
}
|
||||
startUpdateTimestamp();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user