Thursday, January 26, 2012

Ringer Mode Switcher - Program Description

Here is a description of how this app works, including screenshots
Code Walkthrough:

Main Activity Create Event (when the app is created)
  1. The app is created
  2. The default layout is set
  3. Get the phone's ringer state (Normal, Silent, or Vibrate)
  4. Set up buttons so they change the ringer mode when pressed
Main Activity On Resume Event (when the app is re-opened after using a different app)
  1. Get the phone's ringer state (in case it changed)
  2. Refresh screen to display the correct image (See Refresh Screen)
Silent Button On Click Event (when the button on the left is pressed)
  1. If the phone is in silent mode, set it back to normal mode, else set it to silent mode
  2. Refresh screen to display changes (See Refresh Screen
Vibrate Button On Click Event (when the button on the right is pressed)
  1. If the phone is in vibrate mode, set it back to normal mode, otherwise set it it to vibrate mode
  2. Refresh screen to display changes (See Refresh Screen)
Refresh Screen:
  1. Set the image to match the current mode
  2. Change the button text so the two buttons correspond to the other two ringer modes other than the current mode:
    1. If in silent mode, the buttons read "Normal" and "Vibrate"
    2. If in vibrate mode, the buttons read "Silent" and "Normal"
    3. If in normal mode, the buttons read "Silent" and "Vibrate"
Screenshots:
Phone with ringer in normal mode
Phone with ringer in silent mode
Phone with ringer in vibrate mode
Phone in landscape mode

No comments:

Post a Comment