mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-28 03:46:00 +01:00
Refactoring
This commit is contained in:
@@ -211,7 +211,14 @@ public class FixedRecyclerView extends RecyclerView {
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<Runnable, Runnable> mapRunnable = new WeakHashMap<>();
|
||||
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) {
|
||||
@@ -221,7 +228,7 @@ public class FixedRecyclerView extends RecyclerView {
|
||||
action.run();
|
||||
}
|
||||
};
|
||||
mapRunnable.put(action, wrapped);
|
||||
getMapRunnable().put(action, wrapped);
|
||||
return super.post(wrapped);
|
||||
}
|
||||
|
||||
@@ -233,7 +240,7 @@ public class FixedRecyclerView extends RecyclerView {
|
||||
action.run();
|
||||
}
|
||||
};
|
||||
mapRunnable.put(action, wrapped);
|
||||
getMapRunnable().put(action, wrapped);
|
||||
return super.postDelayed(wrapped, delayMillis);
|
||||
}
|
||||
|
||||
@@ -245,7 +252,7 @@ public class FixedRecyclerView extends RecyclerView {
|
||||
action.run();
|
||||
}
|
||||
};
|
||||
mapRunnable.put(action, wrapped);
|
||||
getMapRunnable().put(action, wrapped);
|
||||
super.postOnAnimation(wrapped);
|
||||
}
|
||||
|
||||
@@ -257,13 +264,13 @@ public class FixedRecyclerView extends RecyclerView {
|
||||
action.run();
|
||||
}
|
||||
};
|
||||
mapRunnable.put(action, wrapped);
|
||||
getMapRunnable().put(action, wrapped);
|
||||
super.postOnAnimationDelayed(wrapped, delayMillis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeCallbacks(Runnable action) {
|
||||
Runnable wrapped = mapRunnable.get(action);
|
||||
Runnable wrapped = getMapRunnable().get(action);
|
||||
if (wrapped == null)
|
||||
return super.removeCallbacks(action);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user