Closed greyboxgt closed 4 years ago
Hi Aziz,
Could you tell me which module is this feature hidden in?
Hi, Daniel.
If the bug is about Study mode, then it is on StudyFragment.kt
, have a look at scrollNext()
function.
Almost the same thing is implemented in QuizFragment.kt
.
I see this has been fixed and closed, but I noticed that sliding animation disappears between the last and the first card in the deck. Is this a bug or a feature?
Thank you!
Is it possible to reproduce this in Editing mode as well? It would be so much easier to navigate!
Hi Aziz,
I tried to reproduce this in Editing mode but I couldn't figure out how to do this. I wasn't able to find the scrollNext() function in Editing mode. Can you tell me how I can jump to the first card from the last card in the deck?
Hi Daniel,
It is a bit complicated to implement it in Editor mode. Let me explain how I fixed the issue for Study mode:
RecyclerView
, it recycles invisible view items and reuses them when a particular view type becomes visible.RecyclerView
s view count is returned from getItemCount()
, for ex. if we have 7 cards, then the view count would be 7.getItemCount()
to Int.MAX_VALUE
(instead of 7 for 7 cards, it returns 2147483647). So now we have a lot of card views, we can scroll 2147483647 times.
It does not create 2147483647 views, RecyclerView
creates what is visible on screen, and reuses already created views when you start scrolling:
getItemCount()
in Study mode.Why it is complicated for Editor mode? If we implement the same method for Editor mode, you can always scroll right or left infinitely (2147483647 times!) even if you have only 1 card.
What I propose as a fix: We can push forward on the last card to the first card without animation.
Currently, if there is only one card in the deck, it shows the scrolling animation in Study mode and stalls in Editor mode. Ideally, the only card should not scroll at all in any mode with just one card. I think that killing the animation between the last card and the first card would not be a good idea, and I personally wouldn't mind if the only card in the deck still scrolls in Editor mode and in Study mode, especially if this simplifies the programming.
Thank you for the explanation!
I'm also trying to add the next and previous arrow keys in editor mode for consistency and ease of navigation.
Ok, I have another idea:
What if getItemCount()
returns 2147483647 if cards is more than 1 and 1 if there is only one card, something like this:
override fun getItemCount(): Int {
return if (list.size <= 1) 1 else Int.MAX_VALUE
}
Make sure RecyclerView
binds the appropriate card on onBindViewHolder()
like this in Study mode:
override fun onBindViewHolder(holder: ViewHolder, pos: Int) {
val card = list[pos % list.size]
holder.bind(card)
}
However, this must be heavily tested for card additions, deletions and updates.
I'm also trying to add the next and previous arrow keys in editor mode for consistency and ease of navigation.
Everything like scrolling next, previous cards or shuffling would be the same with Study mode
I am not sure why this issue is closed? Is it not possible to make a carousel in Editing mode? By the way, I don't have enough power to reopen the issues I opened.
Thank you!
If it's hard to do with the animation, pushing forward on the last card to the first card without animation would probably be the best solution. Will it work the similar way when pushing back on the first card?
I will try to code the same logic in Study Mode for Editor mode. Currently, I have been preparing for my final exams in university, can't push the changes this week. Sorry for inconvenience. I read all the new issues, I hope I can fix them next week.
Good luck with your exams!!!
Hi Aziz,
Thank you very much for the fix!
I noticed that all the functions in Study mode already exist in Editing mode. Do you think you can get rid of Study mode at all? I hope this could make the program smaller and easier to manage.
I hope you are doing well with your exams!
Hi Michael,
Thank you, doing good. I hope you're well.
Do you think you can get rid of Study mode at all?
Yes, I see many code duplicates in these two modules. I would do remove duplicates instead of removing Study mode. I use Study mode myself, it prevents editing cards, just with one click, I can flip cards there.
Oh, no, no, no! Please do not remove anything in Editing mode UI, please!!! That would be a HUGE disappointment if you did! I just love it the way it is!! It is so easy to navigate now, even for editing. Please keep the Editing mode the way it is!!
I am not gonna remove anything from Editing mode, just wanted to make sure that I am not repeating myself in Study mode. Maybe, Study mode will use Editing Mode's implementations or better solution would be removing Study mode and hide editing options when a user wants to switch to Study mode.
Thank you for good news!
I use editing mode as study mode, but I understand how distracting could editing options be for some people. I like the idea of hiding the card editing icons when you press the study mode button. What if you keep the three bottom buttons to select the modes? Pressing on the hamburger button in Study mode would switch to editing mode (instead of X on the top left in Study mode). Pressing the hamburger button in Editing mode would take us to Import/Export/Sort/Shuffle/Flip menu which is relative to editing. And pressing on Quiz button will naturally switch to Quiz mode. For me it would be important to keep left-right buttons exactly where they are in editing mode. For consistency, the "+" editing mode button could potentially be moved out of sight to the hamburger menu as "Insert new card" item (if you like). The similar approach could probably be used in Quiz mode, although I have to spend some to figure out how Quiz mode really works and how the statistics is collected.
This is a good idea. Let me try to implement it and let's see how UX changes. I would still prefer having fullscreen Study mode without any distractions. Let me close this issue for now. Feel free to reopen if something comes up.
I have a second thought now about that disappearing sliding animation between the last and the first card in the deck. I like it now because it clearly shows the end of the card set! (unless you have a better option for that!) :smile:
So, I reached the end of the deck. Pressing forward does not do anything. Is it possible to automatically jump to the first card when pushing forward button on the last card in the deck?