|
|
@ -32,9 +32,6 @@ import androidx.annotation.Nullable;
|
|
|
|
import androidx.recyclerview.widget.FastScrollerEx;
|
|
|
|
import androidx.recyclerview.widget.FastScrollerEx;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.WeakHashMap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class FixedRecyclerView extends RecyclerView {
|
|
|
|
public class FixedRecyclerView extends RecyclerView {
|
|
|
|
public FixedRecyclerView(@NonNull Context context) {
|
|
|
|
public FixedRecyclerView(@NonNull Context context) {
|
|
|
|
super(context);
|
|
|
|
super(context);
|
|
|
@ -210,70 +207,4 @@ public class FixedRecyclerView extends RecyclerView {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Map<Runnable, Runnable> mapRunnable = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
|
|
|
|
private Map<Runnable, Runnable> getMapRunnable() {
|
|
|
|
|
|
|
|
if (mapRunnable == null)
|
|
|
|
|
|
|
|
mapRunnable = new WeakHashMap<>();
|
|
|
|
|
|
|
|
return mapRunnable;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean post(Runnable action) {
|
|
|
|
|
|
|
|
Runnable wrapped = new RunnableEx("post") {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void delegate() {
|
|
|
|
|
|
|
|
action.run();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
getMapRunnable().put(action, wrapped);
|
|
|
|
|
|
|
|
return super.post(wrapped);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean postDelayed(Runnable action, long delayMillis) {
|
|
|
|
|
|
|
|
Runnable wrapped = new RunnableEx("postDelayed") {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void delegate() {
|
|
|
|
|
|
|
|
action.run();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
getMapRunnable().put(action, wrapped);
|
|
|
|
|
|
|
|
return super.postDelayed(wrapped, delayMillis);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void postOnAnimation(Runnable action) {
|
|
|
|
|
|
|
|
Runnable wrapped = new RunnableEx("postOnAnimation") {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void delegate() {
|
|
|
|
|
|
|
|
action.run();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
getMapRunnable().put(action, wrapped);
|
|
|
|
|
|
|
|
super.postOnAnimation(wrapped);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void postOnAnimationDelayed(Runnable action, long delayMillis) {
|
|
|
|
|
|
|
|
Runnable wrapped = new RunnableEx("postOnAnimationDelayed") {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void delegate() {
|
|
|
|
|
|
|
|
action.run();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
getMapRunnable().put(action, wrapped);
|
|
|
|
|
|
|
|
super.postOnAnimationDelayed(wrapped, delayMillis);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean removeCallbacks(Runnable action) {
|
|
|
|
|
|
|
|
Runnable wrapped = getMapRunnable().get(action);
|
|
|
|
|
|
|
|
if (wrapped == null)
|
|
|
|
|
|
|
|
return super.removeCallbacks(action);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return super.removeCallbacks(wrapped);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|