DatePickerTimeline
DatePickerTimeline copied to clipboard
Move to specified date (code included)
Hello! Great library! Used it in my project but there are some features that i'm missing so i had to implement them myself.
-
I used a calendar date-picker also to move quickly to specified date that is far away from today so in the same time with setting active date it would be great if focus moved to the date that is set to be active like this: `public void setActiveDate(Calendar activeDate) { try { Date initialDate = new SimpleDateFormat("yyyy-MM-dd") .parse(year + "-" + (month + 1) + "-" + this.date); long diff = activeDate.getTime().getTime() - initialDate.getTime(); int position = (int) (diff / (1000 * 60 * 60 * 24)); adapter.setSelectedPosition(position); int scrollPosition = position - 2; if(scrollPosition < 0){ scrollPosition = 0; } linLayMan.scrollToPosition(scrollPosition); invalidate(); } catch (ParseException e) { e.printStackTrace(); }
} `
linear layout manager should be initialized in init() func: 'linLayMan = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false); setLayoutManager(linLayMan);' 2) Also missing a function to change the color of picked date background - i just created xml that is used in night mode (that's the purpose of it) but it'd be easier using a func
Thanks! 👍