Coder Social home page Coder Social logo

android_interval_timer's Introduction

android_interval_timer

Interval timer beginner android project

android_interval_timer's People

Contributors

adit299 avatar adamrust avatar

Watchers

 avatar

android_interval_timer's Issues

Notification sound not playing in emulator

When notifications trigger in the Android emulator, the notification sound was not playing. I suspect that the issue has to do with:

notificationBuilderAlarm = new NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_launcher_foreground)
.setContentTitle("An interval has finished!!")
.setTimeoutAfter(2000)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setCategory(NotificationCompat.CATEGORY_ALARM);

Mainly, the setTimeoutAfter field. When this field is set to a time that is smaller than the duration for the notification sound, the sound gets cut off when testing on my physical android phone (Pixel 6A). Maybe it ends up not playing at all when testing on an emulator since the notification sound is different with a different duration? Or the noise being cutoff isn't handled in the emulator? I also noticed that increasing the duration of this field leads to unpredictable behaviour (ex. notification noise not playing at all, or only playing for the first notification, etc.). For now, it has been set to a value that leads to the expected behaviour on my phone (sound plays for notification and is not cutoff).

First notification behaviour

  • When you start the timer for the very first time after running the app, the notification with the progress bar is shown when the timer starts
  • It isn't shown on any subsequent run of the timer
  • The desired behaviour is for the progress bar notification to never show when starting the timer (like the behaviour currently when running the timer after the first time)

Swiping back to home screen doesn't cancel the timer

  • Currently when pressing the back button to navigate back to the home/input screen, the timer is first cancelled before ending the activity
  • However, when using the swipe gesture to navigate back, the timer remains running
  • This causes notification to keep showing up on the input screen after navigating back

Acceptance Criteria

  • The timer is cancelled and no longer continues to run after swiping back to the home/input screen

Notification enhancements

  • We now think it would be cool to only show the one notification with the progress bar, rather than sending a new notification on each new interval
  • When not expanded the notification can show the progress bar and number off sets
  • When expanded the notification would show all the timer values

Note:

  • With this change, we also need to look into how the sound will play for each interval

Removing the use of IntervalCountDownTimer library in the project

While looking into adding the alarm capabilities for the app, I stumbled across this on Stack Overflow:

https://stackoverflow.com/questions/28831907/countdowntimer-firing-ontick-at-not-excepted-time-point

  • I think it is worth looking into possibilities of eliminating the use of the IntervalCountDownTimer library in the future, since the way we are using it seems a little "hacky"

  • Utilizing Handler and Runnable might make the app more performant? Not sure..

Fix or remove the number of beeps on main screen

  • The styling of the number of beeps on the main screen is slightly off
  • It also doesn't populate with a value on valid input of the other fields

Proposed Solutions:

  • Remove this field (easiest option), or
  • After implementing validation on selection of each Spinner value, add calculation for number of beeps on valid selection (still simple, and maybe preferred)

Investigate how we can implement beeping

  • We need to see how we can get the phone to produce a noise
  • We also want to see how the phone can vibrate as well
  • We need to investigate how the beeping mechanism can be notified when it is time for it to beep again

UX/UI Improvements

  • Modernize the look and feel of the application
  • Updated colours & button styling
  • Look into Android UI libraries
    Input Page
  • Customized components for time input
    Timer Page
  • Modernized look and feel for timer values and visual representation of the interval
  • Example:
    Beautiful_Interval_Timer_UI

Turn start button turns into pause button

When timer is running, Start button turns into pause button (preferred)

  • When the timer is paused, there is a button to resume
  • Either turn Start into Pause, then Pause into Resume (preferred)
  • Or, have a separate Pause button and grey-out the Start button when timer is running, then grey out pause when timer is paused and re-enable Start to act like a Resume

Get the Second Screen UI functional

  • Ensure that duration field is counting down
  • The countdown timer is counting down towards the next beep
  • The beep counter is updated when the next beep occurs
  • The countdown only starts when the start button is clicked
  • Reset button resets values back to what they were, and the user has to click start again to start the timer
  • Back button allows user to move back to first screen (all values user had entered previously should be present in landing page)

Unexpected swipe gesture behaviour

  • Maybe only producible in the emulator
  • Swiping left or right on the first screen closes the app
  • Swiping left (like the "forward" gesture) on the second screen goes back to the first screen
    • Swipe right ("back" gesture) does the same, which is as expected

Proposed Solution:

  • For the first screen either:
    1. Swiping in either direction does nothing, or
    2. Swiping left goes to the second screen, swiping right does nothing
  • For the second screen:
    • Swiping right should stay as-is
    • Swiping left should do nothing

Meeting plan for October 21st @ 10am

  • Have a concrete idea of what we are trying to accomplish:

    • Exact design ideas
    • Basic UI looks
    • Feature set that we want to have
    • Have an idea of what each of us want to learn from this project
  • Before next meeting, do a little research about:

    • Existing libraries we could utilize
    • Tradeoffs from utilizing a library (are we learning something new or just taking a shortcut?)
    • Pair coding exercise so that we can start to see how to work on the project and split the work at some point later on

Clicking the Start button when the timer is already running starts new timer

  • Need to disable the Start button when the timer is running

Proposed Solution:

  • Either remove or grey-out the button, or
  • Do nothing on click if timer is running
  • When timer is running, Start button turns into pause button (preferred)
    • When the timer is paused, there is a button to resume
    • Either turn Start into Pause, then Pause into Resume (preferred)
    • Or, have a separate Pause button and grey-out the Start button when timer is running, then grey out pause when timer is paused and re-enable Start to act like a Resume

User Input Validation

  • We need to validate that the user has entered appropriate values for duration and interval:
  • We need to somehow ensure that the interval time divides into the duration
  • The interval time must be less than or equal to the duration
  • Also ensure that the correct number of beeps is displayed only if the user has entered appropriate values
    Research needed:
  • Should we perform the validation when the user hits "submit" or as soon as the user enters the values?
  • How to display the error message? (should a error message be displayed, or just some visual cue indicating to the user that the field they have entered is incorrect ex. Red outline, error text, etc.)
  • Ensure that user cannot proceed to the second screen without entering appropriate values

Clicking the Submit button multiple times shows multiple error messages in a row

  • Error messages show up one after the other when clicking the submit button multiple times with invalid inputs
  • If you click the Submit button lots of times and then enter a valid input, the error messages will continue to show in the timer screen

Proposed solution:

  • Minor issue, but I think the minimum solution should be that if you enter a valid input, the error messages do not show on the second screen (i.e. a valid input clears the queue of error messages)
  • More complete solution would be to persist the same error message if the user hits the Submit button lots of times, and hide message a set time after the last Submit
  • Another option could be to disable the submit button until a valid input is selected in the Spinners
    • I think this is the best option, but requires reworking the validation to execute on selection of each Spinner value

Integration of both screens

  • We need to add code to integrate the functionality between both screens:
    (1) Add code so that we are pulling values from the intent within the second screen
    (2) Both the duration and interval needs to be converted to be in terms of Milliseconds, before being passed to the second screen
    • Adam's Suggestion: Add global variables within the Main Activity to house the millisecond values.

"Rest Interval"/additional intervals

  • We would like an option for the user to be able to specify an additional interval field (with an additional countdown timer)
  • So, we could start ideally with a "rest" interval which would trigger after the duration interval has elapsed
  • While the rest interval counts down, all other timers are paused except the duration timer
  • Then, we would like to give the user the ability to specify additional timers

ex.

Sets 4 sets

Duration 2 hours

Interval 15 minute

"Rest" 5 miuntes rest

Timer1 10 minutes

(1) Duration includes the sum of all other timers:

4 sets - duration = 2 hours / sum of timers = (15 minutes + 5 minutes + 10 minutes)

If the user leaves one of the fields blank, but fills in the rest, it can be auto populated as well.

Back Button on Second Screen

  • We would like to look into the functionality of the back button on the second screen:
    • Does Activity.this.finish() exhibit the behaviour that we would want?
    • Look into the behaviour of the default Android back swipe? Is that enough?
    • Bottom line: Do we want the second screen Activity to persist or disappear once the back button is clicked?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.