PrefsFragmentMicrosoftBandPlatformSettings.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:mCerebrum-MicrosoftBand 作者:
private void updatePreferenceScreen() {
    int versionFirmwareInt = getBandVersion();
    findPreference("platformName").setSummary(mySharedPreference.getSharedPreferenceString("platformName"));
    findPreference("deviceId").setSummary(mySharedPreference.getSharedPreferenceString("deviceId"));
    findPreference("platformId").setSummary(getLocationSummary(mySharedPreference.getSharedPreferenceString("platformId")));
    ListPreference lpLocation = (ListPreference) findPreference("platformId");
    lpLocation.setValue(mySharedPreference.getSharedPreferenceString("platformId"));
    MicrosoftBand microsoftBand = new MicrosoftBand(getActivity(), null, null);

    for (int i = 0; i < microsoftBand.getSensors().size(); i++) {
        String dataSourceType = microsoftBand.getSensors().get(i).getDataSourceType();
        ((SwitchPreference) findPreference(dataSourceType)).setChecked(mySharedPreference.getSharedPreferenceBoolean(dataSourceType));
        if (microsoftBand.getSensors().get(i).getVersion() > versionFirmwareInt)
            findPreference(dataSourceType).setEnabled(false);
        else
            findPreference(dataSourceType).setEnabled(true);
        if (dataSourceType.equals(DataSourceType.ACCELEROMETER) || dataSourceType.equals(DataSourceType.GYROSCOPE)) {
            findPreference(dataSourceType).setSummary(mySharedPreference.getSharedPreferenceString(dataSourceType + "_frequency") + " Hz");
            findPreference(dataSourceType).setDefaultValue(mySharedPreference.getSharedPreferenceString(dataSourceType + "_frequency"));
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号