mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 09:38:52 -06:00
Fix NPE in HabitCardView.triggerRipple
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user