danger.audio
Class ProfileGallery

java.lang.Object
  extended by danger.audio.ProfileGallery


public class ProfileGallery
extends Object


Nested Class Summary
static interface ProfileGallery.Class
           
static interface ProfileGallery.Errors
           
 
Field Summary
static int MAX_PROFILES
           
static String PROFILE_LOUD
           
static String PROFILE_MUTE
           
static String PROFILE_NORMAL
           
static String PROFILE_SOFT
           
 
Constructor Summary
ProfileGallery()
           
 
Method Summary
static int add(Profile profile)
          Adds a profile to the gallery.
static Profile get(int index)
          get profile by index.
static Profile get(String name)
          get profile by name.
static Profile getCurrent()
          Get currently selected profile.
static int getCurrentIndex()
          Get the index for the current profile.
static int getMaxSize()
          Return max number of Profile Gallery entries.
static Vector getNames()
          Return Profile names.
static Vector getNames(int klass)
          Return group names given a class to filter.
static int getSize()
          Return number of entries in Profile Gallery
static String getSwitchBackProfileName()
           
static String getSwitchToProfileName()
           
static String getSwitchWeekProfileName()
           
static void initialize()
           
static void initializeFromSysApp()
           
static int load()
          load one byte stream from flash or the service and restore Profiles Returns Errors.OK if found and loaded.
static int remove(Profile profile)
          This will remove a profile from the gallery.
static int replace(Profile oldProfile, Profile newProfile)
          Given a profile that's already in the gallery, replace it with a new one
static void resetDefaults()
          Remove ALL profiles and reset to defaults, including selection of the Normal profile
static void save()
          bundle up all Profiles into one byte stream and write to flash and the service
static int setCurrent(String profileToUse)
          Set the current audio profile, referenced by name.
static void swap(int from, int to)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROFILE_LOUD

public static final String PROFILE_LOUD

PROFILE_NORMAL

public static final String PROFILE_NORMAL

PROFILE_SOFT

public static final String PROFILE_SOFT

PROFILE_MUTE

public static final String PROFILE_MUTE

MAX_PROFILES

public static int MAX_PROFILES
Constructor Detail

ProfileGallery

public ProfileGallery()
Method Detail

initializeFromSysApp

public static void initializeFromSysApp()

initialize

public static void initialize()

resetDefaults

public static void resetDefaults()
Remove ALL profiles and reset to defaults, including selection of the Normal profile


getSwitchToProfileName

public static String getSwitchToProfileName()

getSwitchBackProfileName

public static String getSwitchBackProfileName()

getSwitchWeekProfileName

public static String getSwitchWeekProfileName()

get

public static Profile get(String name)
get profile by name. Returns original.


get

public static Profile get(int index)
get profile by index. Returns original.


add

public static int add(Profile profile)
Adds a profile to the gallery. This will make a copy. Use Get to get this copy.


swap

public static void swap(int from,
                        int to)

replace

public static int replace(Profile oldProfile,
                          Profile newProfile)
Given a profile that's already in the gallery, replace it with a new one


remove

public static int remove(Profile profile)
This will remove a profile from the gallery.


setCurrent

public static int setCurrent(String profileToUse)
Set the current audio profile, referenced by name. Return Errors.OK for ok, Errors.NOT_FOUND for failure


getCurrent

public static Profile getCurrent()
Get currently selected profile. Can return null, meaning the selected profile failed.


getCurrentIndex

public static int getCurrentIndex()
Get the index for the current profile.


getMaxSize

public static int getMaxSize()
Return max number of Profile Gallery entries. May not all be active.


getSize

public static int getSize()
Return number of entries in Profile Gallery


getNames

public static Vector getNames()
Return Profile names. Returns String objects stored as a Vector object


getNames

public static Vector getNames(int klass)
Return group names given a class to filter. Returns String objects stored as a Vector object


save

public static void save()
bundle up all Profiles into one byte stream and write to flash and the service


load

public static int load()
load one byte stream from flash or the service and restore Profiles Returns Errors.OK if found and loaded. Errors.NOT_FOUND if nothing in flash Errors.NOT_SETUP if what's in flash is the wrong version