androidx.preference.SeekBarPreference Java Examples

The following examples show how to use androidx.preference.SeekBarPreference. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GeneralPreferenceFragment.java    From NClientV2 with Apache License 2.0 6 votes vote down vote up
private void dataMenu() {
    addPreferencesFromResource(R.xml.settings_data);
    SeekBarPreference mobile=findPreference(getString(R.string.key_mobile_usage));
    SeekBarPreference wifi=findPreference(getString(R.string.key_wifi_usage));
    mobile.setOnPreferenceChangeListener((preference, newValue) -> {
        mobile.setTitle(getDataUsageString((Integer) newValue));
        return true;
    });
    wifi.setOnPreferenceChangeListener((preference, newValue) -> {
        wifi.setTitle(getDataUsageString((Integer) newValue));
        return true;
    });
    mobile.setTitle(getDataUsageString(mobile.getValue()));
    wifi.setTitle(getDataUsageString(wifi.getValue()));
    mobile.setUpdatesContinuously(true);
    wifi.setUpdatesContinuously(true);
}