pull/214/head
M66B 8 months ago
parent 95f5b22778
commit 15709d128f

@ -119,24 +119,4 @@ public class FixedConstraintLayout extends ConstraintLayout {
return false; return false;
} }
} }
@Override
public boolean post(Runnable action) {
return super.post(new RunnableEx("post") {
@Override
protected void delegate() {
action.run();
}
});
}
@Override
public boolean postDelayed(Runnable action, long delayMillis) {
return super.postDelayed(new RunnableEx("postDelayed") {
@Override
protected void delegate() {
action.run();
}
}, delayMillis);
}
} }

@ -59,24 +59,4 @@ public class FixedCoordinatorLayout extends CoordinatorLayout {
return false; return false;
} }
} }
@Override
public boolean post(Runnable action) {
return super.post(new RunnableEx("post") {
@Override
protected void delegate() {
action.run();
}
});
}
@Override
public boolean postDelayed(Runnable action, long delayMillis) {
return super.postDelayed(new RunnableEx("postDelayed") {
@Override
protected void delegate() {
action.run();
}
}, delayMillis);
}
} }

@ -72,24 +72,4 @@ public class FixedFrameLayout extends FrameLayout {
return false; return false;
} }
} }
@Override
public boolean post(Runnable action) {
return super.post(new RunnableEx("post") {
@Override
protected void delegate() {
action.run();
}
});
}
@Override
public boolean postDelayed(Runnable action, long delayMillis) {
return super.postDelayed(new RunnableEx("postDelayed") {
@Override
protected void delegate() {
action.run();
}
}, delayMillis);
}
} }

@ -52,24 +52,4 @@ public class FixedLinearLayout extends LinearLayout {
return false; return false;
} }
} }
@Override
public boolean post(Runnable action) {
return super.post(new RunnableEx("post") {
@Override
protected void delegate() {
action.run();
}
});
}
@Override
public boolean postDelayed(Runnable action, long delayMillis) {
return super.postDelayed(new RunnableEx("postDelayed") {
@Override
protected void delegate() {
action.run();
}
}, delayMillis);
}
} }

@ -47,24 +47,4 @@ public class FixedNestedScrollView extends NestedScrollView {
Log.w(ex); Log.w(ex);
} }
} }
@Override
public boolean post(Runnable action) {
return super.post(new RunnableEx("post") {
@Override
protected void delegate() {
action.run();
}
});
}
@Override
public boolean postDelayed(Runnable action, long delayMillis) {
return super.postDelayed(new RunnableEx("postDelayed") {
@Override
protected void delegate() {
action.run();
}
}, delayMillis);
}
} }

@ -32,6 +32,9 @@ 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);
@ -208,23 +211,62 @@ public class FixedRecyclerView extends RecyclerView {
} }
} }
private Map<Runnable, Runnable> mapRunnable = new WeakHashMap<>();
@Override @Override
public boolean post(Runnable action) { public boolean post(Runnable action) {
return super.post(new RunnableEx("post") { Runnable wrapped = new RunnableEx("post") {
@Override @Override
protected void delegate() { protected void delegate() {
action.run(); action.run();
} }
}); };
mapRunnable.put(action, wrapped);
return super.post(wrapped);
} }
@Override @Override
public boolean postDelayed(Runnable action, long delayMillis) { public boolean postDelayed(Runnable action, long delayMillis) {
return super.postDelayed(new RunnableEx("postDelayed") { Runnable wrapped = new RunnableEx("postDelayed") {
@Override
protected void delegate() {
action.run();
}
};
mapRunnable.put(action, wrapped);
return super.postDelayed(wrapped, delayMillis);
}
@Override
public void postOnAnimation(Runnable action) {
Runnable wrapped = new RunnableEx("postOnAnimation") {
@Override @Override
protected void delegate() { protected void delegate() {
action.run(); action.run();
} }
}, delayMillis); };
mapRunnable.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();
}
};
mapRunnable.put(action, wrapped);
super.postOnAnimationDelayed(wrapped, delayMillis);
}
@Override
public boolean removeCallbacks(Runnable action) {
Runnable wrapped = mapRunnable.get(action);
if (wrapped == null)
return super.removeCallbacks(action);
else
return super.removeCallbacks(wrapped);
} }
} }

@ -50,24 +50,4 @@ public class FixedRelativeLayout extends RelativeLayout {
return false; return false;
} }
} }
@Override
public boolean post(Runnable action) {
return super.post(new RunnableEx("post") {
@Override
protected void delegate() {
action.run();
}
});
}
@Override
public boolean postDelayed(Runnable action, long delayMillis) {
return super.postDelayed(new RunnableEx("postDelayed") {
@Override
protected void delegate() {
action.run();
}
}, delayMillis);
}
} }

@ -53,24 +53,4 @@ public class FixedView extends View {
return false; return false;
} }
} }
@Override
public boolean post(Runnable action) {
return super.post(new RunnableEx("post") {
@Override
protected void delegate() {
action.run();
}
});
}
@Override
public boolean postDelayed(Runnable action, long delayMillis) {
return super.postDelayed(new RunnableEx("postDelayed") {
@Override
protected void delegate() {
action.run();
}
}, delayMillis);
}
} }

Loading…
Cancel
Save