当前位置: 首页>>代码示例>>Java>>正文


Java DataSourceType.COMPASS属性代码示例

本文整理汇总了Java中org.md2k.datakitapi.source.datasource.DataSourceType.COMPASS属性的典型用法代码示例。如果您正苦于以下问题:Java DataSourceType.COMPASS属性的具体用法?Java DataSourceType.COMPASS怎么用?Java DataSourceType.COMPASS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.md2k.datakitapi.source.datasource.DataSourceType的用法示例。


在下文中一共展示了DataSourceType.COMPASS属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-PhoneSensor,代码行数:34,代码来源:PrefsFragmentSettings.java

示例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;
    }
 
开发者ID:MD2Korg,项目名称:mCerebrum-PhoneSensor,代码行数:34,代码来源:PrefsFragmentSettings.java

示例3: Compass

public Compass(Context context) {
    super(context, DataSourceType.COMPASS);
    frequency = SENSOR_DELAY_UI;
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-PhoneSensor,代码行数:4,代码来源:Compass.java


注:本文中的org.md2k.datakitapi.source.datasource.DataSourceType.COMPASS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。