Fix NPE in HabitCardView.triggerRipple
This commit is contained in:
parent
de3b97dfdf
commit
a73459784e
@ -143,12 +143,13 @@ public class HabitCardView extends FrameLayout
|
|||||||
updateBackground(isSelected);
|
updateBackground(isSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void triggerRipple(long timestamp)
|
public synchronized void triggerRipple(long timestamp)
|
||||||
{
|
{
|
||||||
long today = DateUtils.getStartOfToday();
|
long today = DateUtils.getStartOfToday();
|
||||||
long day = DateUtils.millisecondsInOneDay;
|
long day = DateUtils.millisecondsInOneDay;
|
||||||
int offset = (int) ((today - timestamp) / day) - dataOffset;
|
int offset = (int) ((today - timestamp) / day) - dataOffset;
|
||||||
CheckmarkButtonView button = checkmarkPanel.indexToButton(offset);
|
CheckmarkButtonView button = checkmarkPanel.indexToButton(offset);
|
||||||
|
if (button == null) return;
|
||||||
|
|
||||||
float y = button.getHeight() / 2.0f;
|
float y = button.getHeight() / 2.0f;
|
||||||
float x = checkmarkPanel.getX() + button.getX() + button.getWidth() / 2;
|
float x = checkmarkPanel.getX() + button.getX() + button.getWidth() / 2;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user