Hi everyone! I'm working in a composable that rece...
# compose
a
Hi everyone! I'm working in a composable that receives an hour in Unix, UTC ( a Long value like 1608124431 ). I want to check if the next hour the composable receives is before or after the current hour displayed. How could I achieve this? My first approach was trying to remember the last hour but I missed up on how to access the last hour displayed...
a
how do you want this composable to respond to this particular state change? Thinking in terms of state changes rather than in terms of time-agnostic declaration can be a hint that there might be a smoother way to represent something.
a
Thanks for your response, Adam. What I want is this composable to move frontward or backward based on the starter hour. Assume it is 5, if the next hour 6, I want it to move 2.dp to the right and if is 4, 2.dp to the left, I want the number of dp to be cumulative. My idea was to calculate the offset by the difference between the hours, but I understand your point. I Will try to figure out a new approach to represent the state.
a
I think you might find some of the compose animation APIs helpful here, they'll take care of dealing with the difference between old values and you can write your code in terms of just the current (new) values
👍 1