mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-27 11:25:13 +01:00
Fixed views
This commit is contained in:
@@ -24,6 +24,9 @@ import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
public class FixedRelativeLayout extends RelativeLayout {
|
||||
public FixedRelativeLayout(Context context) {
|
||||
super(context);
|
||||
@@ -50,4 +53,39 @@ public class FixedRelativeLayout extends RelativeLayout {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<Runnable, Runnable> mapRunnable = new WeakHashMap<>();
|
||||
|
||||
@Override
|
||||
public boolean post(Runnable action) {
|
||||
Runnable wrapped = new RunnableEx("post") {
|
||||
@Override
|
||||
protected void delegate() {
|
||||
action.run();
|
||||
}
|
||||
};
|
||||
mapRunnable.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();
|
||||
}
|
||||
};
|
||||
mapRunnable.put(action, wrapped);
|
||||
return super.postDelayed(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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user