本文整理汇总了Java中org.md2k.datakitapi.source.datasource.DataSourceType.AMBIENT_LIGHT属性的典型用法代码示例。如果您正苦于以下问题:Java DataSourceType.AMBIENT_LIGHT属性的具体用法?Java DataSourceType.AMBIENT_LIGHT怎么用?Java DataSourceType.AMBIENT_LIGHT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.md2k.datakitapi.source.datasource.DataSourceType
的用法示例。
在下文中一共展示了DataSourceType.AMBIENT_LIGHT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSensorSupported
boolean isSensorSupported(String dataSourceType) {
SensorManager mSensorManager;
Sensor mSensor;
mSensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);
switch (dataSourceType) {
case DataSourceType.ACCELEROMETER:
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
break;
case (DataSourceType.GYROSCOPE):
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
break;
case (DataSourceType.AMBIENT_TEMPERATURE):
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE);
break;
case (DataSourceType.COMPASS):
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
break;
case (DataSourceType.AMBIENT_LIGHT):
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
break;
case (DataSourceType.PRESSURE):
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PRESSURE);
break;
case (DataSourceType.PROXIMITY):
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
break;
case DataSourceType.LOCATION:
return getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS);
default:
return true;
}
return mSensor != null;
}
示例2: createSwitchPreference
private SwitchPreference createSwitchPreference(String dataSourceType) {
SwitchPreference switchPreference = new SwitchPreference(getActivity());
switchPreference.setKey(dataSourceType);
String title = dataSourceType;
title = title.replace("_", " ");
title = title.substring(0, 1).toUpperCase() + title.substring(1).toLowerCase();
switchPreference.setTitle(title);
switchPreference.setOnPreferenceChangeListener(onPreferenceChangeListener);
switchPreference.setEnabled(isSensorSupported(dataSourceType));
switch (dataSourceType) {
case (DataSourceType.ACCELEROMETER):
switchPreference.setOnPreferenceClickListener(alertDialogFrequency(Accelerometer.frequencyOptions));
break;
case (DataSourceType.GYROSCOPE):
switchPreference.setOnPreferenceClickListener(alertDialogFrequency(Gyroscope.frequencyOptions));
break;
case (DataSourceType.AMBIENT_TEMPERATURE):
// switchPreference.setOnPreferenceClickListener(alertDialogFrequency(AmbientTemperature.frequencyOptions));
break;
case (DataSourceType.COMPASS):
switchPreference.setOnPreferenceClickListener(alertDialogFrequency(Compass.frequencyOptions));
break;
case (DataSourceType.AMBIENT_LIGHT):
switchPreference.setOnPreferenceClickListener(alertDialogFrequency(AmbientLight.frequencyOptions));
break;
case (DataSourceType.PRESSURE):
// switchPreference.setOnPreferenceClickListener(alertDialogFrequency(Pressure.frequencyOptions));
break;
case (DataSourceType.PROXIMITY):
// switchPreference.setOnPreferenceClickListener(alertDialogFrequency(Proximity.frequencyOptions));
break;
}
return switchPreference;
}
示例3: AmbientLight
public AmbientLight(Context context) {
super(context, DataSourceType.AMBIENT_LIGHT);
frequency = SENSOR_DELAY_UI;
}
示例4: AmbientLight
AmbientLight() {
super(DataSourceType.AMBIENT_LIGHT, "2", 2);
}