com.drismo.model
Class Config

java.lang.Object
  extended by com.drismo.model.Config

public class Config
extends java.lang.Object

This class keeps track of all the preferences for the application.


Field Summary
private static java.lang.String currentLangTitle
           
private static boolean dimScreen
           
private static boolean gpsExists
           
private static java.lang.String languageCode
           
private static boolean logGps
           
private static boolean powerSaver
           
private static int prefMonitor
           
private static boolean replyCall
           
private static java.lang.String replyMsg
           
private static boolean replySMS
           
private static float speedConv
           
private static java.lang.String speedUnit
           
private static int ttsFrequency
           
private static boolean useTts
           
 
Constructor Summary
Config()
           
 
Method Summary
static boolean autoReplyCall()
          Check whether auto reply on is activated for incoming calls or not.
static boolean autoReplySms()
          Check whether auto reply on is activated for incoming messages or not.
static boolean deviceHasGps()
          Check if a GPS is present in the device.
static java.lang.String getAutoReplyMsg()
          Gets the message that will be sent as auto-reply to incoming requests.
static boolean getDimScreen()
          Check whether the dim screen setting is enabled or not.
static java.lang.String getLangSummaryText()
          Get the description text for the language preference.
static java.lang.String getLanguageCode()
          Get the language code to set as locale.
static int getPrefMonitor()
          Get the preferred monitor style.
static float getSpeedConv()
          Gets the speed conversion constant.
static java.lang.String getSpeedUnit()
          Get the preferred speed unit.
static int getTtsMinuteFrequency()
          Get the frequency for the TTS feature.
static void initializePreferences(android.content.Context c, android.content.SharedPreferences prefs)
          Set all preferences.
static boolean logGps()
          Check whether GPS-logging is activated or not.
static boolean powerSaverOn()
          Check whether the power saver is activated or not.
static void setAutoReplyCall(boolean reply)
          Sets the boolean that decides whether or not to send auto-reply message on incoming calls.
static void setAutoReplyMsg(java.lang.String msg)
          Sets the message that will be sent as auto-reply to incoming requests.
static void setAutoReplySms(boolean reply)
          Sets the boolean that decides whether or not to send auto-reply message on incoming messages.
static void setConfigLocale(android.content.Context c, java.lang.String lang)
          Changing default Locale, to activate selected language in the application.
static void setDimScreen(boolean dim)
          Set the boolean for the dim screen setting.
static void setGpsExists(boolean gps)
          Store information about whether or not the device has GPS.
static void setLangCode(java.lang.String lang)
          Set language code.
static void setLangSummaryText(java.lang.String lang)
          Set the description text for the language preference.
static void setLogGps(boolean log)
          Enable/Disable GPS-logging.
static void setPowerSaver(boolean ps)
          Enable/Disable power saver.
static void setPrefMonitor(int monitor)
          Setting what monitor is default.
static void setSpeedConv(java.lang.String unit)
          Sets the speed conversion constant
static void setSpeedUnit(java.lang.String unit)
          Set preferred speed measurement unit.
static void setTtsFrequency(int freq)
          Set how often to give feedback via TTS.
static void setUseTts(boolean tts)
          Set the boolean for the TTS setting.
static boolean useTts()
          Check if the TTS feature is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

replySMS

private static boolean replySMS

replyCall

private static boolean replyCall

logGps

private static boolean logGps

powerSaver

private static boolean powerSaver

dimScreen

private static boolean dimScreen

gpsExists

private static boolean gpsExists

useTts

private static boolean useTts

prefMonitor

private static int prefMonitor

replyMsg

private static java.lang.String replyMsg

languageCode

private static java.lang.String languageCode

currentLangTitle

private static java.lang.String currentLangTitle

speedUnit

private static java.lang.String speedUnit

speedConv

private static float speedConv

ttsFrequency

private static int ttsFrequency
Constructor Detail

Config

public Config()
Method Detail

autoReplySms

public static boolean autoReplySms()
Check whether auto reply on is activated for incoming messages or not.

Returns:
True if the setting activated. False otherwise.

autoReplyCall

public static boolean autoReplyCall()
Check whether auto reply on is activated for incoming calls or not.

Returns:
True if the setting activated. False otherwise.

logGps

public static boolean logGps()
Check whether GPS-logging is activated or not.

Returns:
True if GPS-logging is enabled. False otherwise.

powerSaverOn

public static boolean powerSaverOn()
Check whether the power saver is activated or not.

Returns:
True if power saving is activated. False otherwise.

getAutoReplyMsg

public static java.lang.String getAutoReplyMsg()
Gets the message that will be sent as auto-reply to incoming requests.

Returns:
The message string

getLangSummaryText

public static java.lang.String getLangSummaryText()
Get the description text for the language preference.

Returns:
The description

getLanguageCode

public static java.lang.String getLanguageCode()
Get the language code to set as locale.

Returns:
The language code.

getPrefMonitor

public static int getPrefMonitor()
Get the preferred monitor style.
1 = Primitive
2 = Wheel
3 = Map

Returns:
Integer value for preferred monitor style.

getTtsMinuteFrequency

public static int getTtsMinuteFrequency()
Get the frequency for the TTS feature.

Returns:
The frequency in minutes.

getDimScreen

public static boolean getDimScreen()
Check whether the dim screen setting is enabled or not.

Returns:
True if the setting is enabled. False otherwise.

useTts

public static boolean useTts()
Check if the TTS feature is enabled.

Returns:
True if it is enabled. False otherwise.

deviceHasGps

public static boolean deviceHasGps()
Check if a GPS is present in the device.

Returns:
True if the device has GPS. False otherwise.

getSpeedConv

public static float getSpeedConv()
Gets the speed conversion constant. (km/h or mph)

Returns:
if km/h return 3.6f, else mph return 2.24f

getSpeedUnit

public static java.lang.String getSpeedUnit()
Get the preferred speed unit.

Returns:
String with the short name for the speed unit. (km/t, mph or m/s)

setAutoReplySms

public static void setAutoReplySms(boolean reply)
Sets the boolean that decides whether or not to send auto-reply message on incoming messages.

Parameters:
reply - True if the auto-reply setting is activated for messages. False otherwise.

setAutoReplyCall

public static void setAutoReplyCall(boolean reply)
Sets the boolean that decides whether or not to send auto-reply message on incoming calls.

Parameters:
reply - True if the auto-reply setting is activated for calls. False otherwise.

setLangCode

public static void setLangCode(java.lang.String lang)
Set language code.

Parameters:
lang - The language code

setLangSummaryText

public static void setLangSummaryText(java.lang.String lang)
Set the description text for the language preference.

Parameters:
lang - The description

setAutoReplyMsg

public static void setAutoReplyMsg(java.lang.String msg)
Sets the message that will be sent as auto-reply to incoming requests.

Parameters:
msg - The message

setLogGps

public static void setLogGps(boolean log)
Enable/Disable GPS-logging.

Parameters:
log - True if GPS should be logged. False otherwise.

setPowerSaver

public static void setPowerSaver(boolean ps)
Enable/Disable power saver.

Parameters:
ps - True if power saver should be enabled. False otherwise.

setPrefMonitor

public static void setPrefMonitor(int monitor)
Setting what monitor is default.
1 = Primitive
2 = Wheel
3 = Map

Parameters:
monitor - Integer value of monitor to set as default.

setDimScreen

public static void setDimScreen(boolean dim)
Set the boolean for the dim screen setting.

Parameters:
dim - True if dim screen is allowed. False otherwise.

setUseTts

public static void setUseTts(boolean tts)
Set the boolean for the TTS setting.

Parameters:
tts - True if the setting has been enabled. False otherwise.

setTtsFrequency

public static void setTtsFrequency(int freq)
Set how often to give feedback via TTS.

Parameters:
freq - Frequency given in minutes.

setGpsExists

public static void setGpsExists(boolean gps)
Store information about whether or not the device has GPS.

Parameters:
gps - True if the device has GPS. False otherwise.

setSpeedConv

public static void setSpeedConv(java.lang.String unit)
Sets the speed conversion constant

Parameters:
unit - if km/h set 3.6f, else mph set 2.24f

setSpeedUnit

public static void setSpeedUnit(java.lang.String unit)
Set preferred speed measurement unit.

Parameters:
unit - The short name for the preferred speed unit. (km/t, mph or m/s)

initializePreferences

public static void initializePreferences(android.content.Context c,
                                         android.content.SharedPreferences prefs)
Set all preferences. Call this function to set up preferences on application startup.

Parameters:
c - The context
prefs - The SharedPreferences object.

setConfigLocale

public static void setConfigLocale(android.content.Context c,
                                   java.lang.String lang)
Changing default Locale, to activate selected language in the application.

Parameters:
c - the context
lang - Abbreviation for the language. (i.e. 'en' for english or 'no' for norwegian.)