Kuroba-Experimental icon indicating copy to clipboard operation
Kuroba-Experimental copied to clipboard

More date formats

Open crisalis2 opened this issue 2 years ago • 5 comments

The full date format for posts is month/day/year and this little detail triggers me like you wouldn't believe, so I would like more options. Either day/month/year or year/month/day are fine in my book.

crisalis2 avatar Jul 22 '21 06:07 crisalis2

Hi could I take on this issue?

gabriellaabdennabi avatar Jul 22 '21 23:07 gabriellaabdennabi

Sure.

K1rakishou avatar Jul 23 '21 07:07 K1rakishou

Probably it's not going to be as easy as it may seem. There is this class ThreadCellData which holds a list of PostCellData and PostCellData is basically a class of precalculated and cached values that are used to draw PostCells (basically posts that you see in thread/catalog).

So the place where the post date is calculated is in PostCellData.calculatePostTime(). So basically you need to change that place. The hard part is that, you will probably notice it after implementing a new setting to change the date format, is that after changing the setting, the currently visible posts (in the recycler) will still have the same old date. That's because of the caching. What you need to do to make the visible posts updated right after the setting is changed is to add your new setting to PostCellData and to the place where it's instantiated - ThreadCellData.postIndexedListToPostCellDataList(). Every time the adapter is notified to redraw items, a diff-check happens to figure out what posts were changed and need to be updated. That's why you need to add your setting to the PostCellData, otherwise postDataDiffers will return false and the post won't be updated.

K1rakishou avatar Jul 23 '21 09:07 K1rakishou

Okay thank you for the help.Are there any steps I need to take to run it properly in android studio?

gabriellaabdennabi avatar Jul 23 '21 15:07 gabriellaabdennabi

No, you should be able to run it without any problems. But you maybe probably need to select the devDebug build flavor.

K1rakishou avatar Jul 23 '21 15:07 K1rakishou