public static final class

CMSettings.Global

extends Settings.NameValueTable
java.lang.Object
   ↳ android.provider.Settings.NameValueTable
     ↳ cyanogenmod.providers.CMSettings.Global

Class Overview

Global settings, containing miscellaneous CM global preferences. This table holds simple name/value pairs. There are convenience functions for accessing individual settings entries.

Summary

Constants
String SYS_PROP_CM_SETTING_VERSION
String WEATHER_TEMPERATURE_UNIT Global temperature unit in which the weather data will be reported Valid values are:

CELSIUS

FAHRENHEIT

[Expand]
Inherited Constants
From class android.provider.Settings.NameValueTable
From interface android.provider.BaseColumns
Fields
public static final Uri CONTENT_URI
Public Constructors
CMSettings.Global()
Public Methods
static float getFloat(ContentResolver cr, String name, float def)
Convenience function for retrieving a single settings value as a floating point number.
static float getFloat(ContentResolver cr, String name)
Convenience function for retrieving a single system settings value as a float.
static int getInt(ContentResolver cr, String name, int def)
Convenience function for retrieving a single settings value as an integer.
static int getInt(ContentResolver cr, String name)
Convenience function for retrieving a single settings value as an integer.
static long getLong(ContentResolver cr, String name, long def)
Convenience function for retrieving a single settings value as a long.
static long getLong(ContentResolver cr, String name)
Convenience function for retrieving a single settings value as a long.
static String getString(ContentResolver resolver, String name)
Look up a name in the database.
static Uri getUriFor(String name)
Construct the content URI for a particular name/value pair, useful for monitoring changes with a ContentObserver.
static boolean putFloat(ContentResolver cr, String name, float value)
Convenience function for updating a single settings value as a floating point number.
static boolean putInt(ContentResolver cr, String name, int value)
Convenience function for updating a single settings value as an integer.
static boolean putLong(ContentResolver cr, String name, long value)
Convenience function for updating a single settings value as a long integer.
static boolean putString(ContentResolver resolver, String name, String value)
Store a name/value pair into the database.
[Expand]
Inherited Methods
From class android.provider.Settings.NameValueTable
From class java.lang.Object

Constants

public static final String SYS_PROP_CM_SETTING_VERSION

Added in API level 2

Constant Value: "sys.cm_settings_global_version"

public static final String WEATHER_TEMPERATURE_UNIT

Added in API level 5

Global temperature unit in which the weather data will be reported Valid values are:

CELSIUS

FAHRENHEIT

Constant Value: "weather_temperature_unit"

Fields

public static final Uri CONTENT_URI

Added in API level 2

Public Constructors

public CMSettings.Global ()

Added in API level 2

Public Methods

public static float getFloat (ContentResolver cr, String name, float def)

Added in API level 2

Convenience function for retrieving a single settings value as a floating point number. Note that internally setting values are always stored as strings; this function converts the string to an float for you. The default value will be returned if the setting is not defined or not a valid float.

Parameters
cr The ContentResolver to access.
name The name of the setting to retrieve.
def Value to return if the setting is not defined.
Returns
  • The setting's current value, or 'def' if it is not defined or not a valid float.

public static float getFloat (ContentResolver cr, String name)

Added in API level 2

Convenience function for retrieving a single system settings value as a float. Note that internally setting values are always stored as strings; this function converts the string to a float for you.

This version does not take a default value. If the setting has not been set, or the string value is not a number, it throws CMSettings.CMSettingNotFoundException.

Parameters
cr The ContentResolver to access.
name The name of the setting to retrieve.
Returns
  • The setting's current value.
Throws
CMSettings.CMSettingNotFoundException Thrown if a setting by the given name can't be found or the setting value is not a float.

public static int getInt (ContentResolver cr, String name, int def)

Added in API level 2

Convenience function for retrieving a single settings value as an integer. Note that internally setting values are always stored as strings; this function converts the string to an integer for you. The default value will be returned if the setting is not defined or not an integer.

Parameters
cr The ContentResolver to access.
name The name of the setting to retrieve.
def Value to return if the setting is not defined.
Returns
  • The setting's current value, or 'def' if it is not defined or not a valid integer.

public static int getInt (ContentResolver cr, String name)

Added in API level 2

Convenience function for retrieving a single settings value as an integer. Note that internally setting values are always stored as strings; this function converts the string to an integer for you.

This version does not take a default value. If the setting has not been set, or the string value is not a number, it throws CMSettings.CMSettingNotFoundException.

Parameters
cr The ContentResolver to access.
name The name of the setting to retrieve.
Returns
  • The setting's current value.
Throws
CMSettings.CMSettingNotFoundException Thrown if a setting by the given name can't be found or the setting value is not an integer.

public static long getLong (ContentResolver cr, String name, long def)

Added in API level 2

Convenience function for retrieving a single settings value as a long. Note that internally setting values are always stored as strings; this function converts the string to a long for you. The default value will be returned if the setting is not defined or not a long.

Parameters
cr The ContentResolver to access.
name The name of the setting to retrieve.
def Value to return if the setting is not defined.
Returns
  • The setting's current value, or 'def' if it is not defined or not a valid long.

public static long getLong (ContentResolver cr, String name)

Added in API level 2

Convenience function for retrieving a single settings value as a long. Note that internally setting values are always stored as strings; this function converts the string to a long for you.

This version does not take a default value. If the setting has not been set, or the string value is not a number, it throws CMSettings.CMSettingNotFoundException.

Parameters
cr The ContentResolver to access.
name The name of the setting to retrieve.
Returns
  • The setting's current value.
Throws
CMSettings.CMSettingNotFoundException Thrown if a setting by the given name can't be found or the setting value is not an integer.

public static String getString (ContentResolver resolver, String name)

Added in API level 2

Look up a name in the database.

Parameters
resolver to access the database with
name to look up in the table
Returns
  • the corresponding value, or null if not present

public static Uri getUriFor (String name)

Added in API level 3

Construct the content URI for a particular name/value pair, useful for monitoring changes with a ContentObserver.

Parameters
name to look up in the table
Returns
  • the corresponding content URI

public static boolean putFloat (ContentResolver cr, String name, float value)

Added in API level 2

Convenience function for updating a single settings value as a floating point number. This will either create a new entry in the table if the given name does not exist, or modify the value of the existing row with that name. Note that internally setting values are always stored as strings, so this function converts the given value to a string before storing it.

Parameters
cr The ContentResolver to access.
name The name of the setting to modify.
value The new value for the setting.
Returns
  • true if the value was set, false on database errors

public static boolean putInt (ContentResolver cr, String name, int value)

Added in API level 2

Convenience function for updating a single settings value as an integer. This will either create a new entry in the table if the given name does not exist, or modify the value of the existing row with that name. Note that internally setting values are always stored as strings, so this function converts the given value to a string before storing it.

Parameters
cr The ContentResolver to access.
name The name of the setting to modify.
value The new value for the setting.
Returns
  • true if the value was set, false on database errors

public static boolean putLong (ContentResolver cr, String name, long value)

Added in API level 2

Convenience function for updating a single settings value as a long integer. This will either create a new entry in the table if the given name does not exist, or modify the value of the existing row with that name. Note that internally setting values are always stored as strings, so this function converts the given value to a string before storing it.

Parameters
cr The ContentResolver to access.
name The name of the setting to modify.
value The new value for the setting.
Returns
  • true if the value was set, false on database errors

public static boolean putString (ContentResolver resolver, String name, String value)

Added in API level 2

Store a name/value pair into the database.

Parameters
resolver to access the database with
name to store
value to associate with the name
Returns
  • true if the value was set, false on database errors