Best option to set dynamic interactive clock in bottom nav

Hello all,

For my current project at work we have a special bonus for the person who can make the clock icon, which we have in our bottom nav, dynamic. Meaning, it should update every 5 minutes and show a sign for minutes and for hours. Now my approach would be firstly to create a custom class which has setters for the pointers from the clock.

Doesn’t sound so hard yet now does it?

But as soon as you create a function with the input params (rotation degrees for both pointers) and return a drawable you need to have some listener which triggers (as long as your inside the app) that 5 minutes have passed and drawable in bottom nav should be changed accordingly.

I was wondering, how and why would you guys solve this?

My own steps are as follows as of now:

  1. Get materials (2 pointers and a circle with background color)
  2. Create function which dynamically sets the pointers and returns a drawable
  3. Create some sort of callback / listener to update your clock every 5 minutes
  4. Calculate time and round it down to 5 minutes and hours and set 30 degrees rotation for every 5 minutes that passed and reset after full hour is done.
  5. Programmatically set the drawable in bottom nav (every 5 minutes)
  6. step 3 -> how/where can I get/make a callback which signals me every 5 minutes

I’m kinda stuck right now because i’m not sure if I should even start this. Hope someone has a better way than this to solve this problem.

submitted by /u/frankhardenberg
[link] [comments]